In C # .Net, here is a simple example of how to format numbers into strings using custom format strings: (example taken from: http://www.csharp-examples.net/string-format-int/ )
String.Format("{0:+### ### ### ###}", 447900123456); // "+447 900 123 456" String.Format("{0:##-####-####}", 8958712551); // "89-5871-2551"
Is there a way to convert this formatted string back to long / integer? Is there any way to do this:
long PhoneNumber = Int32.Parse("89-5871-2551", "{0:##-####-####}");
I saw that DateTime has a ParseExact method that can work well. But I have not seen such a thing for int / long / decimal / double.
source share