String Novice Question

1. Senior Member
Join Date
Dec 1969
Posts
223

## String Novice Question

Hi Guys I have a simple question. I neet to break this string up into small portions: <BR><BR>WholeString= "Jane=9,Julie=7,Karen=10,Beautiful=10,Pretty=8,SoS o=6"<BR><BR>As you can see the delimeters are = and , until the last value, The string will always return these parameters in order but only with different values. I want to list as follows:<BR><BR>Jane&#039;s Rank: 9<BR>Julie&#039;s Rank: 7<BR>Karen&#039;s Rank: 10<BR><BR>Rank Values:<BR>Value for Beautiful is: 10<BR>Value for Pretty is: 8<BR>Value for So So is: 8<BR><BR><BR>Again, Here&#039;s the simple string, please help:<BR><BR>WholeString= "Jane=9,Julie=7,Karen=10,Beautiful=10,Pretty=8,SoS o=6"<BR><BR><BR>

2. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## R&D Split() <eop>

.

3. Senior Member
Join Date
Dec 1969
Posts
223

## RE: R&D Split() <eop>

Thanks, a simple example would help too. I know about the split function I just cant figure out how to break this string down.

4. Senior Member
Join Date
Dec 1969
Posts
905

## Some help?

Your not making life too easy for yourself by trying to create too seperate lists from one string with no obvious (programatically) start and end point for each list.<BR><BR>You may want to consider breaking it into two lists;<BR><BR>eg;<BR><BR>strChicks = "Betty=5, Sarah=8, Lisa=5"<BR>strRanks = "Fox=10, Pussycat=8, Dog=6, Pig=4"<BR><BR>Or if that is not an option make it obvious in your string<BR><BR>eg;<BR><BR>str = "StartChicks Betty=5,Sarah=4 EndChicks StartRanks Fox=10, Pussycat=8 EndRanks"<BR><BR>Other functions you may want to look at for this are InstrRev(), Replace() and possibly Left() and Right().<BR><BR>Matt<BR>

5. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## maybe so

but YOU try using it and when you get stuck come back.<BR><BR><BR>a = "b,f,f,g,h,e,s"<BR>array = split(a, ",")<BR><BR>then each char between the , in a will be in an element of the array.<BR><BR>Work from there.<BR><BR>

6. Senior Member
Join Date
Dec 1969
Posts
223

## RE: Some help?

Thanks Matt, I suggested that. Its not my DB, but he wants me to read the values from it. Any other way to read the string as easily as possible?

7. Senior Member
Join Date
Dec 1969
Posts
905

## Possibly

If you know the order that say, ranks, will appear in eg, &#039;Beatiful&#039; will always be listed first you could perhaps use InstrRev() to work out where the ranks actually start. Then you could use the numeric value you&#039;ve just got with a Left() or Right() function.<BR><BR>Havn&#039;t got a lot of time at the moment but if you want I can knock up an example later and post it in the morning.<BR><BR>Matt

8. Senior Member
Join Date
Dec 1969
Posts
223

## RE: Possibly

Thanks I figured out what to do. I appended "Start" "End" to the WholeString and named it WholeString2 as a combination of both. That way it contained start and end as as values of WholeString 2. I appreciate all your help.<BR><BR><BR>Joe

9. Senior Member
Join Date
Dec 1969
Posts
905

## Cool! No problem

I think you should have a chat with your mate about his database design though, sounds like there could be room for improvement.<BR><BR>See ya<BR><BR>Matt

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•