1. RE: match use
- Posted by irv at take.maxleft.com
May 14, 2002
sixs at ida.net wrote:
> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0009_01C1FB7D.60B2D120
> charset="iso-8859-1"
>
>
> I am having a problem with match. location is to hold the starting =
> position of Name is the string of data. I want to then pick the Name =
> and to he data following for value of Name. My illustration doesn't =
> work. Is the result location "Name" a number value?=20
> I want to put the value of name back into data. I have described =
> location as an atom,
>
>
> function InsertCRLFs(sequence data)
> atom location
> sequence dat dat =3D {}
>
> location =3D match("Name", data)
> -- location is set to 3
>
> =20
> dat =3D getText(data[location..3])
> return dat
> end function
1. Please don't post in HTML.
2. getText retrieves text from a Windows control using
the handle to that control. data[location..3] will
return a single character, not a handle.
Why are you using it here?
3. Match finds the location of a string within a longer
string:
if the longer string is "My Name Is Mudd",
then match ("Name",longer_string) will return 4.
M=1
y=2
space=3
N=4
4.You say "I want to then pick the Name and to he data
following for value of Name."
This makes no sense. I am only guessing now, but
if you want to return the portion of the string
from "Name" on thru the end of the string, then
try this:
location = match("Name",string)
substring = string[location..length(string)]
If that's not what you are trying to do, please
try your question again.
Regards,
Irv