4货币转换2种方式 [英] 4 currency conversion 2 way

查看:90
本文介绍了4货币转换2种方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张货币表,其中包含4种货币SGD,INR,USD AUD,我需要转换总共12次转换使用此api



i have a currency table,that contain 4 Currency SGD,INR,USD AUD,I need to convert the total 12 conversion Using this api

public static string CurrencyConvert(decimal amount, string fromCurrency, string toCurrency)
   {

       //Grab your values and build your Web Request to the API
       string apiURL = String.Format("https://www.google.com/finance/converter?a={0}&from={1}&to={2}&meta={3}", amount, fromCurrency, toCurrency, Guid.NewGuid().ToString());

       //Make your Web Request and grab the results
       var request = WebRequest.Create(apiURL);

       //Get the Response
       var streamReader = new StreamReader(request.GetResponse().GetResponseStream(), System.Text.Encoding.ASCII);

       //Grab your converted value (ie 2.45 USD)
       var result = Regex.Matches(streamReader.ReadToEnd(), "<span class=\"?bld\"?>([^<]+)</span>")[0].Groups[1].Value;

       //Get the Result
       return result;
   }




SGD to INR;
SGD to USD;
SGD to AUD,

INR to SGD,
INR to USD,
INR to AUD,

AUD to SGD,
AUD to INR,
AUD to USD,

USD to SGD
USD to AUD,
USD to INR,

推荐答案

参考这篇文章,

http://www.c-sharpcorner.com/UploadFile/0c1bb2/live-currency-converter-using-Asp-Net-C-Sharp/ [ ^ ]
Hi, refer this article,
http://www.c-sharpcorner.com/UploadFile/0c1bb2/live-currency-converter-using-Asp-Net-C-Sharp/[^]


这篇关于4货币转换2种方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆