![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | format text hi i'am trying to format a string 123012345612 as follwed 123-0123456-12 i am try to show this text in the propred mask. with left({sting},1) & "-" &..... but did not succeesd. What i am doing wrong ? regards , Gerog |
My System Specs![]() |
| | #2 (permalink) |
| | Re: format text Hello Georg, Quote: > hi > i'am trying to format a string 123012345612 as follwed > 123-0123456-12 i > am try to show this text in the propred mask. with left({sting},1) & > "-" > &..... but did not succeesd. What i am doing wrong ? > regards , Gerog line of code? It is very hard to answer your question with as little you've provided. I'm guessing here, but I guess this would work. It does however not explain why your original doesn't work. You could use regex for this problem. And you could parse the number as an int an use string.Format. string value = "12345678901"; string formatted = string.Empty; formatted = Regex.Replace(value, "^([0-9]{3})([0-9]{6})([0-9]{2})$", "${1}-${2}-${3}"); formatted = string.Format("{0:000-000000-00}", long.Parse(value)); -- Jesse Houwing jesse.houwing at sogeti.nl |
My System Specs![]() |
| | #3 (permalink) |
| | Re: format text Hello Georg, Quote: > hi > i'am trying to format a string 123012345612 as follwed > 123-0123456-12 i > am try to show this text in the propred mask. with left({sting},1) & > "-" > &..... but did not succeesd. What i am doing wrong ? > regards , Gerog But I find the other two easier to read. (This one will be substantially faster). string value = "12345678901"; string formatted = string.Empty; formatted = value.Substring(0, 3) + "-" + value.Substring(3, 6) + "-" + value.Substring(9, 2); -- Jesse Houwing jesse.houwing at sogeti.nl |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How Change Format to Plain Text? | Live Mail | |||
| Rich text format to word format | .NET General | |||
| Rich text format or HTML format | Vista performance & maintenance | |||
| Text box format change | .NET General | |||
| Mail Receipient - Plain text format? | Vista mail | |||