0

I have below string.

Message GID=1191539226 ID=1191539226-1

How do you retrieve the id value 1191539226-1 only using vbscript split

I used solution given by Ekkehard.Horner

2
  • So did you try to do that? Commented Apr 7, 2015 at 14:19
  • I tried out , Thanks a lot Commented Apr 7, 2015 at 14:33

2 Answers 2

1

You can use the split function:

Split(expression[,delimiter[,count[,compare]]]) 

Default delimiter is a space, so can most easily do this in 2 steps, the first to get ID=1191539226-1, and the second to split on =

For your example:

input = "Message GID=1191539226 ID=1191539226-1"
a = Split(input)
b = Split(a(2), "=")
result = b(1)
Sign up to request clarification or add additional context in comments.

Comments

0

You want the last part separated by "=". So:

>> s = "Message GID=1191539226 ID=1191539226-1"
>> a = Split(s, "=")
>> WScript.Echo a(Ubound(a))
>>
1191539226-1
>>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.