Home > DeveloperSection > Forums > How can I format a string?
marcel ethan
marcel ethan

Total Post:105

Points:735
Posted on    November-14-2013 12:52 AM

 C# C# 
Ratings:


 1 Reply(s)
 723  View(s)
Rate this:

My string looks like 0145655789, I want to change its format to 0145.655.789

This is the code I tried:

enterpriseCode.Append(String.Format("{0:####.###.###}", aNum.ToString()).Replace(";", ""));

But it giving me same string, not giving me desired string.

How to do it?



Pravesh Singh

Total Post:411

Points:2881
Posted on    November-14-2013 1:23 AM

Hi marcel,

You can try this:-

string formatted = enterpriseCode.Insert(4, ".").Insert(8, ".");

Hope this will solve your problem.

Don't want to miss updates? Please click the below button!

Follow MindStick