Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I got Account Number=4549163506238472 .This Account number I want to get into format 4549-1635-0623-8472 .How can I do this ?Please help me.

I am using C#

 

Thanks in Advance

ima
Posted

Console.WriteLine(new System.Text.RegularExpressions.Regex("([0-9]{4})").Replace("4549163506238472","$1-").TrimEnd('-'));

 

This assumes that the length of your string % 4 == 0.

  • 3 weeks later...
Posted

I solved this issue by using the following.

 

 

 

StringBuilder sb = new StringBuilder(argstring);

sb.Insert(4,"-");

sb.Insert(9,"-");

sb.Insert(14,"-");

return sb.ToString;

 

 

 

 

Thank u all for their effort

ima

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...