Find whole or find word with apostrophe
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Find whole or find word with apostrophe
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?
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?
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9
Re: Find whole or find word with apostrophe
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
if the s you are looking for is an uppercase S then you could
Code: Select all
set the caseSensitive to true
Kind regards
Bernd
Re: Find whole or find word with apostrophe
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
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
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.
tryon
Craig's
S
s
Sumatra
Kind regards
Bernd
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
Craig's
S
s
Sumatra
Kind regards
Bernd
Re: Find whole or find word with apostrophe
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.
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9
Re: Find whole or find word with apostrophe
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
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