Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to convert string!

Status
Not open for further replies.

hinchdog

Programmer
Feb 14, 2001
380
US
I need to convert the following string using VBScript --

3/13/01 5:24:11 PM to 01,3,13,5,24,11

Is there a regex guru who can help me! Thx.

-Hinchdog
 
Code:
dim thisString, thatString
thisString = "3/13/01 5:24:11 PM"
thatString = replace(thisString, "/", ",")
thisString = replace(thatString, ":", ",")
thatString = left(thisString, 15)

That should do it. If there is the possibility of different length strings, then you would need to use the len function to get the length of the almost final string (the one that still has the 'PM' on it), and then just subtract 3 from the return value to know what value to use with the left function.

good luck!:)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top