My application is in Asp.Net MVC3 coded in C#.Net. Im using google Currency Conversion API for getting the conversion.
Google Currency Conversion API Im passing the From Currency and To Currency values and the amount to my Controller. Below is my C# code.
WebClient web = new WebClient();
string url = string.Format("http://www.google.com/ig/calculator?hl=en&q={2}{0}%3D%3F{1}", CurrenctCurr.ToUpper(), DestinationCurr.ToUpper(), TotCurrentPay);
string response = web.DownloadString(url);
Regex regex = new Regex("rhs: \"(\d*.\d*)");
Match match = regex.Match(response);
decimal rate = Convert.ToDecimal(match.Groups[1].Value);
错线
decimal rate = Convert.ToDecimal(match.Groups[1].Value.ToString());
The error is Input string not in Correct format.There is no inner exception to it.
我试图将其改为稳定。
decimal rate = Convert.ToDecimal(match.Groups[1].Value.ToString());
同时,我试图将match的数值乘以微薄的变量,然后尝试对其采取分层逻辑。 但它没有工作
string test = match.ToString();
test=test.substring(0,test.Indexof("""));
There is a single Quotation ("),so im trying to take the value of string till ". Suggest how can i solve the issue.Or what else can i try in the right direction.