string manipulation

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 11 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
zxc1029
Posts: 65
Last visit: Wed Oct 03, 2012 12:45 am

string manipulation

Post by zxc1029 »

text = "C:PROGRA~3SymantecDEFINI~1VIRUSD~120120329.002"In this text the last part is date "20120329.002"I would like to filter this text and get the following results03-29-2012 Rev 2May be we could split the string using "" delimeter and then filter the date part with startswith 20 and then may be tostring method. I dont know how to put this all together in VBscript. Kindly help.
User avatar
zxc1029
Posts: 65
Last visit: Wed Oct 03, 2012 12:45 am

string manipulation

Post by zxc1029 »

text = "C:PROGRA~3SymantecDEFINI~1VIRUSD~120120329.002"In this text the last part is date "20120329.002"I would like to filter this text and get the following results03-29-2012 Rev 2May be we could split the string using "" delimeter and then filter the date part with startswith 20 and then may be tostring method. I dont know how to put this all together in VBscript. Kindly help.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

string manipulation

Post by jvierra »

Start here: http://www.w3schools.com/vbscript/func_mid.asp

You need Left, Right, Mid and InStr functions.

Ther eare planty of examples on the site.jvierra2012-03-30 15:41:05
User avatar
zxc1029
Posts: 65
Last visit: Wed Oct 03, 2012 12:45 am

string manipulation

Post by zxc1029 »

Thanks
User avatar
zxc1029
Posts: 65
Last visit: Wed Oct 03, 2012 12:45 am

string manipulation

Post by zxc1029 »

Thanks, used those function, its working as expected.
This topic is 11 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked