Fields of Joy... but Start of Line? (='.'=)
Posted: Thu May 30, 2013 4:33 pm
Ciao a tutti!!!!
I am continuing to study the basics of LiveCode!
(but not the English language!... sorry)
I'm stuck on another problem from beginner ...
I have a list of strings in a field (fString) to be compared (exactly!, case sensitive...) with a list of another field (fWordOk).
A textbook problem, right? For a newbie...
Here is the example...
field fString content
aaaaaaa
bbbbbbb
Aaaaaaa
bbbbbbB
aaaA
lkjlkjlkjlk
Cat
aaa
field fWordOk content
aaaaaaa
bbbbbbb
Aaaaaaa
bbbbbbB
aaaa
Here is the simple
code:
And here is the result!:
aaaaaaa -----------> exist !!!
bbbbbbb -----------> exist !!!
Aaaaaaa -----------> exist !!!
bbbbbbB -----------> exist !!!
aaaA -----------> does not exist !!!
lkjlkjlkjlk -----------> does not exist !!!
Cat -----------> does not exist !!!
but...
aaa -----------> exist !!!
(=*.*=)
My "elegant"
solution in PigCode is:
But... what is the translation of the STARTOFLINE command from PigCode to LiveCode? 
Thanks again to everyone!!
Grazie a tutti e baci!!!!!!
Mariasole
(='.'=)
I am continuing to study the basics of LiveCode!

I'm stuck on another problem from beginner ...

I have a list of strings in a field (fString) to be compared (exactly!, case sensitive...) with a list of another field (fWordOk).
A textbook problem, right? For a newbie...

Here is the example...
field fString content
aaaaaaa
bbbbbbb
Aaaaaaa
bbbbbbB
aaaA
lkjlkjlkjlk
Cat
aaa
field fWordOk content
aaaaaaa
bbbbbbb
Aaaaaaa
bbbbbbB
aaaa
Here is the simple

Code: Select all
on mouseUp
repeat for each line tLine in field "fString"
set the caseSensitive to true
set the wholeMatches to true
answer tLine
IF (tLine & return) is not in field "fWordOk" THEN
answer "the word |" & tLine & "| does not exist !!!"
ELSE
answer "the word |" & tLine & "| exist !!!"
end if
end repeat
end mouseUp
And here is the result!:
aaaaaaa -----------> exist !!!

bbbbbbb -----------> exist !!!

Aaaaaaa -----------> exist !!!

bbbbbbB -----------> exist !!!

aaaA -----------> does not exist !!!

lkjlkjlkjlk -----------> does not exist !!!

Cat -----------> does not exist !!!

but...
aaa -----------> exist !!!



My "elegant"

Code: Select all
IF (STARTOFLINE & tLine & return) is not in field "fWordOk" THEN...

Thanks again to everyone!!
Grazie a tutti e baci!!!!!!
Mariasole
(='.'=)