compare text

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

compare text

Post by aebki » Thu May 21, 2015 9:48 am

Hi,

How can i compare to string / text to see if they are equals?

In fact what i want is to be able to see if for example that: "Hello" is different of "hello".
So the 'matchText' is not useful i think...

regards.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: compare text

Post by Thierry » Thu May 21, 2015 10:11 am

Hi,

You can prefix your regex with (?i), i.e: "(?i)HellO"
to be case insensitive.
In fact what i want is to be able to see if for example that: "Hello" is different of "hello".
and for this, you don't and "HellO' should not match "hello"

Or did I miss something?

Regards,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: compare text

Post by aebki » Thu May 21, 2015 2:15 pm

Hi Thierry,

Thanks for your answer! :-)

In fact i need to compare what i wrote in one field with what i have in one variable that i am reading from one database...

So my question was how to compare the text of field "FldPassword" with the variable MyPassword.

if the text of field "FldPassword" is not MyPassword then


end if

So if i understood well, this should work?

if the text of field "FldPassword" is not (?¡)MyPassword then


end if

Regards.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: compare text

Post by Thierry » Thu May 21, 2015 2:27 pm

aebki wrote: So my question was how to compare the text of field "FldPassword" with the variable MyPassword.
Umm, my answer was specific to matchText(), matchChunk() or replaceText() functions.

In your case, you only need to add a statement:

Code: Select all

set the caseSensitive to true
if the text of field "FldPassword" is not MyPassword then ...
HTH,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

aebki
Posts: 126
Joined: Tue Jan 06, 2015 5:48 pm

Re: compare text

Post by aebki » Mon May 25, 2015 8:10 pm

Hi Thierry,

Thanks for your answer...

And sorry for my late answer...I didn't enter in the forum till today...:-(

I will test it!

Regards.

Post Reply

Return to “Talking LiveCode”