I have a string with value \"1131200001103\".
How can I display it as a string in this format \"11-312-001103\" using Response.Write(value)?
Thanks
You can try a regular expression and put this inside an extension method ToMaskedString()
public static class StringExtensions
{
public static string ToMaskedString(this String value)
{
var pattern = "^(/d{2})(/d{3})(/d*)$";
var regExp = new Regex(pattern);
return regExp.Replace(value, "$1-$2-$3");
}
}
Then call
respne.Write(value.ToMaskedString());