I am getting a social security number (SSN) from a data warehouse. While posting it to a CRM I want it to be formatted like XXX-XX-XXXX instead of XXXXXXXXX.
It's like converting a simple string with dashes at positions 4 and 7. I am pretty new to C#, so what is the best way to do this?
For a simple, short, and self commenting solution, try:
String.Format("{0:000-00-0000}", 123456789)
123456789 representing your SSN variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With