>> set tempcheck1 = char 1 of gcommstring
>> if (tempcheck1=P then PLAY)
>> 
>> Now though I cannot use this technique because I do not know which order a
>> very long string will be arriving in. I'd basically like to look for a name
>> and then read it's value. Data will be arriving in the following as below:
>> 
>> RAE 123 LLF 225.........
>> 
>> In this example RAE is a variable and 123 is it's value. I'd like to look for
>> it in a string and record it's value.
> 
> 
> What about something like:
> requiredVariable = "RAE"
> thisMany = the number of words of gcommstring
> 
> repeat with x = 1 to thisMany
> if word x of gcommstring =  requiredVariable  then
> myValue = word x + 1 of gcommstring
> exit repeat
> else
> x = x + 1
> end if
> end repeat

Alternatively (Untested):

on getNameValue nameString, sourceString
  charLocation = offset(nameString, sourceString)
  counterString = sourceString.char[1..charLocation]
  return sourceString.word[the number of words in counterString + 1]
end

Note that this will return the first value in the source string if there are
multiple instances of the nameString. And it's not picky about whether the
nameString it's looking for is a complete word, unlike Owen's example. So,
your approach depends on your data - if you have unique identifiers for each
value that you want to retrieve, you'll be fine with either of the above. If
there are common names, however, you'll need to make the handler more
complex.

FWIW,
Kurt


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to