Format a string VB.Net, VS2005
Posted on 2008-06-12
I may be crazy, but I need to allow the user to input a selection of numbers in to a text box. I have provide directions to separte each by comma's, but you know how that goes.
This is much the same as the "Print range" in the common printer dialog box where you can put pages 1, 5, 8, 22
The output needs to be reformatted so that each entry is 4 digits (preceeding zero's if necessary) and separated by commas.
So, if the user puts in "1, 35, 400" the resulting string will be "0001,0035, 0400".
Basically seperating by the comma's, and then reformatting to four digits (pad left with zero?)
Less important, but I am also not sure if there is a way to account for other variations ("1 35 400", "1-35/400" etc) and have the the resulting output string still be "0001,0035, 0400".
Thanks in advance,