fork(11) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static string Hex2Dec(string m)
  10. {
  11. return int.Parse(m, System.Globalization.NumberStyles.HexNumber).ToString();
  12. }
  13.  
  14. public static void Main()
  15. {
  16. var s = "private var color:uint = 0xff000010\nprivate var something:uint = 0xf2010\nprivate var anotherNumber:int = 5435344";
  17. var res = Regex.Replace(s, @"(?i)\b0x([a-f0-9]+)\b", m => Hex2Dec(m.Groups[1].Value));
  18. Console.WriteLine(res);
  19. }
  20. }
Success #stdin #stdout 0.11s 24336KB
stdin
Standard input is empty
stdout
private var color:uint = -16777200
private var something:uint = 991248
private var anotherNumber:int = 5435344