JabbaTheNut
Programmer
I have phone numbers that are in 10 digit format (i.e., 2125558888). I want to format them in the following manner: "(212) 555-8888".
I know I can do the following:
--------------------------------------------
string myNum = "2125558888"; //the source would be a field in a database
string myPhone;
myPhone = "(" + myNum.Substring(0,3) + "
" + myNum.Substring(3,3) + "-" + myNum.Substring(6,4);
--------------------------------------------
However, I would like to do something more concise like this:
--------------------------------------------
string.Format("{0
###) ###-####}", myNum);
--------------------------------------------
What is the proper syntax to do this?
Game Over, Man!
I know I can do the following:
--------------------------------------------
string myNum = "2125558888"; //the source would be a field in a database
string myPhone;
myPhone = "(" + myNum.Substring(0,3) + "
--------------------------------------------
However, I would like to do something more concise like this:
--------------------------------------------
string.Format("{0
--------------------------------------------
What is the proper syntax to do this?
Game Over, Man!