DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Search in a string?

Solved!
Go to solution
How can i choose From a string example monkey=3 fr.o.m. String: (Apple=2,bananas=4,monkey=3,blue=8)
They are comma separated.
0 Kudos
Message 1 of 4
(5,828 Views)

Hi LVdummies,

 

Please try this:

 

dim sText, sTextArray, iLoop

sText = "Apple=2,bananas=4,monkey=3,blue=8"
sTextArray = split(sText, ",")

for iLoop = 0 to uBound(sTextArray)
  msgbox sTextArray(iLoop)
next

 

Greetings

Walter

0 Kudos
Message 2 of 4
(5,815 Views)

Hello,

If i want to pick out for example" monkey" from the string.

How will the code look like then ?

0 Kudos
Message 3 of 4
(5,812 Views)
Solution
Accepted by topic author LVdummies
dim sText, sTextArray, iLoop

sText = "Apple=2,bananas=4,monkey=3,blue=8"
sTextArray = split(sText, ",")

for iLoop = 0 to uBound(sTextArray)
  msgbox sTextArray(iLoop)
  msgbox left(sTextArray(iLoop), inStr(sTextArray(iLoop), "=") - 1)
next

Greetings

Walter

Message 4 of 4
(5,810 Views)