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

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

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

Postby arjfca » 21 Jul 2011

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

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

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

Postby TJ » 21 Jul 2011

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.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

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

Postby arjfca » 21 Jul 2011

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


Return to “User Contributed Studies and Indicator Library”