sureshcd10 Posted July 11, 2006 Posted July 11, 2006 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 Quote ima
mskeel Posted July 11, 2006 Posted July 11, 2006 You could treat the account number as a string and insert the dashes using String.Insert(). Quote
Gill Bates Posted July 11, 2006 Posted July 11, 2006 Console.WriteLine(new System.Text.RegularExpressions.Regex("([0-9]{4})").Replace("4549163506238472","$1-").TrimEnd('-')); This assumes that the length of your string % 4 == 0. Quote
sureshcd10 Posted July 28, 2006 Author Posted July 28, 2006 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 Quote ima
Administrators PlausiblyDamp Posted July 28, 2006 Administrators Posted July 28, 2006 long l = 4549163506238472; string s = l.ToString("0000-0000-0000-0000"); would be a quicker way. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.