fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string sdesptchNo = "BOL";
  9. var prefix = Regex.Match(sdesptchNo, "^\\d+").Value;
  10. var number = Regex.Replace(sdesptchNo, "^\\d+", "");
  11. var i = int.Parse(number) + 1;
  12. var newString = prefix + i.ToString(new string('0', number.Length));
  13.  
  14. Console.WriteLine(prefix);
  15. Console.WriteLine(number);
  16. Console.WriteLine(newString);
  17.  
  18. }
  19. }
Runtime error #stdin #stdout #stderr 0.03s 140480KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x0005e] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Test.Main () [0x00028] in <9ca5e80f9d144e98853ac1cf4dcf59d5>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x0005e] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.Int32.Parse (System.String s) [0x00007] in <8f2c484307284b51944a1a13a14c0266>:0 
  at Test.Main () [0x00028] in <9ca5e80f9d144e98853ac1cf4dcf59d5>:0