Page 1 of 1
Find whole or find word with apostrophe
Posted: Tue May 28, 2013 6:59 pm
by JackD
I'm having a problem with the find command when a field contains an apostrophe. A statement like
find whole "s" or find word "s"
stops at each 's (apostrophe s, as in it's) in the field.
I'm searching an index for a line that has only an S in it. The only workaround that I can figure out is a loop that repeats the find until the line = "S". Is there a simpler way to do this in LiveCode?
Re: Find whole or find word with apostrophe
Posted: Tue May 28, 2013 8:14 pm
by bn
Hi JackD,
if the s you are looking for is an uppercase S then you could
if not it gets a bit more involved
Kind regards
Bernd
Re: Find whole or find word with apostrophe
Posted: Tue May 28, 2013 8:51 pm
by dunbarx
I am not seeing this. And I was worried when I read your post. If I have a field with text in it:
aaa bbb ccc's ddd
eee ccc's ggg
hhh ccc's kkk
find whole "ccc's" finds each instance of "ccc's", complete. You can even find them all in a repeat loop:
on mouseUp
repeat 3
find whole"ccc's" in fld "f44"
wait 44
end repeat
end mouseUp
Craig Newman
Re: Find whole or find word with apostrophe
Posted: Tue May 28, 2013 9:03 pm
by bn
Hi Craig,
as far as I understand it is the other way around. Jack wants to find a single S. He uses find word. That also finds the s in Craig's. That is the problem.
try
Code: Select all
on mouseUp
-- set the caseSensitive to true
set the wholeMatches to true
find word "S" in field 1
end mouseUp
on
Craig's
S
s
Sumatra
Kind regards
Bernd
Re: Find whole or find word with apostrophe
Posted: Tue May 28, 2013 10:05 pm
by JackD
Bernd is correct, I'm searching for a single S. The wholeMatches doesn't make a difference in my stack but caseSensitive does so I'll use that. I really didn't want to use a loop to find it. Thanks Bernd.
Re: Find whole or find word with apostrophe
Posted: Wed May 29, 2013 2:00 pm
by Klaus
Hi Jack,
you are searching a LINE that consist from a single capital S?
Then use LINEOFFSET:
...
set the wholematches to TRUE
put lineoffset("S",fld 1)
...
Best
Klaus