Making string comparisons case sensitive

John Baughman (3/19/14 5:13PM)


John Baughman (3/19/14 5:13 PM)

On Mar 8, 2014, at 3:14 PM, Cannon Smith wrote:

color><param>00000,0000,DDEE/param>IIf you first check that the
strings are the same length (and not zero length), then:

If (Position(Old($pField->);$pField->;*)#1)
//Then they are different

is equivalent to a case sensitive comparison.
/color>

A week or so ago I asked this question and do not think I ever thanked
Cannon for this great little tip. Thanks Cannon!

If anyone is interested I wrote a simple wrapper for it listed below.
I think it covers all the bases.

John

John Baughman
Kailua, Hawaii
(808) 262-0328
johnbdh@...

----------------------------------------
//Method: StringsAreDifferent("first string";"second string")
C_TEXT($firstString;$1;$secondString;$2)
C_BOOLEAN($0)

$firstString:=$1
$secondString:=$2

Case of
=A0=A0: ($firstString+$secondString="")
=A0=A0=A0=A0=A0=A0$0:=False

=A0=A0: (Length($firstString)#Length($secondString))
//need this because it will break if $firstString was the same
as
$secondString but for some reason got cut off
=A0=A0=A0=A0=A0=A0=A0$0:=True

=A0Else
=A0=A0=A0=A0=A0=A0$0:=(Position($firstString;$secondSt
ring;*)#1)

End case

Reply to this message

Summary created 3/20/14 at 6:43AM by Intellex Corporation

Comments welcome at: feedback@intellexcorp.com