Looking for a practical way to format string
I came across the following: Convert.ToUInt64(string).ToString(@"00000\-000")
.
Is it a good practice to use this method to format strings
? Is there a recommended way?
Here is an example of the usage:
public class Program
{
public static void Main()
{
var nomeCep = "JOSE - 09017092";
var cep = nomeCep.Split('-')[1];
Console.WriteLine(Convert.ToUInt64(cep).ToString(@"00000\-000"));
}
}
Result: 09017-092