Page 1 of 1

In String (Instr "Text,Of,a string")..2' occurence of ","

Posted: 21 Jul 2011
by arjfca
Hello

Maybe a simple question, but i did not resolved it

I got a string "Text,Of,a string")
I want to decode what is the characters number for each comma " , "

Instr("Text,Of,a string"), "," ) will give me the occurrence of the first ","

I need to get it for all " , " of the string. In Excel it is fairly easy since you have to enter the starting position in the string.

Martin

Re: In String (Instr "Text,Of,a string")..2' occurence of ",

Posted: 21 Jul 2011
by TJ
Hello

Maybe a simple question, but i did not resolved it

I got a string "Text,Of,a string")
I want to decode what is the characters number for each comma " , "

Instr("Text,Of,a string"), "," ) will give me the occurrence of the first ","

I need to get it for all " , " of the string. In Excel it is fairly easy since you have to enter the starting position in the string.

Martin
You have to put it in a loop.

First, find out the length of the string, so that you can determine the size of the loop.

Then run the string through the loop, looking for the comma.
If a comma is encountered, you have the found the string.

Re: In String (Instr "Text,Of,a string")..2' occurence of ",

Posted: 21 Jul 2011
by arjfca
Hello TJ

I did resolve the problem by modifying my approach

I did post my split string function for Excel and fo MC here
viewtopic.php?f=5&t=8950&p=42264#p42264

Basically, you send a comma separated string, with a number representing the position of the string that you need. The output will be a string representing it

Have a good evening ( or morning ) :)

Martin