Hi All,
I have to read a registry value and have to parse that value according to my requirement.

C:\Program Files\Software_name\quest\\setup.exe,0

I Have to parse the above string in such way that....it will see from Right side and when it will get "\\" it will return value from 1st char to the character before "\\"

can anybody tell me how to do that???

"C:\Program Files\Software_name\quest" this portion can be anything of any length.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Look at VBScript's Split function.

Btw, this post seems more suited for the scripting forum, a forum admin might move it.

PJ
Answered 01/07/2011 by: pjgeutjens
Red Belt

Please log in to comment
0
Yeah. Here's a quick example. The first example is what pj describes. The second example (I believe) is what you're describing.....but either would be fine.
Dim testvalue : testvalue = "C:\Program Files\Software_name\quest\\setup.exe,0"

Dim example1 : example1 = split(testvalue,"\\")(0)
Dim example2 : example2 = Left(testvalue, InStrRev(testvalue, "\\") - 1)

MsgBox example1
MsgBox example2
Answered 01/07/2011 by: captain_planet
Second Degree Brown Belt

Please log in to comment
0
captain,

small remark, won't the second example cause an error if the split string is not in the testvalue?
Since you'll effectively be calling
Dim example2 : example2 = Left(testvalue, 0 - 1)
PJ
Answered 01/07/2011 by: pjgeutjens
Red Belt

Please log in to comment
0
...with no suitable error handling, it sure will. [;)] Mind you, even if the split string didn't exist in the Split() example, it would still return an undesired result. So i guess my example assumes that the OP puts in his own error handling/other checks....
Answered 01/07/2011 by: captain_planet
Second Degree Brown Belt

Please log in to comment
0
No offence to anyone but look at the question: do you suppose the OP even knows HOW to add error-trapping?
Answered 01/07/2011 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity