fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string response = "{lhs: \"1,0 U.S. dollar\",rhs: \"9 708,73786 Indonesian rupiahs\",error: \"\",icc: true}";
  9.  
  10. Regex regex = new Regex(@"(?<=rhs: \"")(\d[\s,]?)+");
  11. Match match = regex.Match(response);
  12. string value = Regex.Replace(match.ToString(), @"\s", "");
  13. decimal decimalValue = System.Convert.ToDecimal(value);
  14. Console.WriteLine(decimalValue);
  15. }
  16. }
Success #stdin #stdout 0.08s 34048KB
stdin
Standard input is empty
stdout
970873786