Identify text from a text field
Posted: Sun Oct 13, 2024 2:12 pm
What is the code for identifying certain words from a text field? (I also want to get the row number)
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
You can use -> lineoffset that will give you the line number (= row)liveCode wrote: Sun Oct 13, 2024 2:12 pmWhat is the code for identifying certain words from a text field? (I also want to get the row number)
Code: Select all
...
put "whatever" into tWord2Search4
put lineoffset(tWord2Search4,fld "the textfield") into tLineNumber
answer tLineNumber
## Will give you the line number with the FIRST occurrence of that word or 0 (Zero),
## if the word is NOT in the text of the field
...Code: Select all
on mouseUp
ask "Find?"
find empty
repeat
find it in fld 1
put the foundChunk & return after temp
if the result = "not found" then exit repeat
end repeat
answer temp
end mouseUpThat is beautifully simple in LiveCode:liveCode wrote: Fri Nov 01, 2024 12:02 pm Hi. Thanks for the code. I would also like a code that gives "TRUE" or "FALSE" depending on whether the certain word is in the text
thanks
Code: Select all
answer tMyWord is in field 1