If I had a phone number like this
string phone = "6365555796";
What I only store with numeric characters in my database (as a string) , is it possible to display the number as follows:
"636-555-5796"
Like me, if I were to use a number:
long phone = 6365555796; string output = phone.ToString("000-000-0000");
I tried searching, and all I could find on the Internet was numeric formatting documents.
The reason I'm asking for is because I think it would be an interesting idea to be able to store only numeric values ββin the database and allow different formatting using the Constant string value to dictate how my phone numbers are formatted. Or am I better off using a number for this?
EDIT: The question is about formatting a string containing numbers, not the number itself.
source share