Case-sensitive comparisons of strings function - Forum

Forum Navigation
Embarcadero contest retweet
You need to log in to create posts and topics.

Case-sensitive comparisons of strings function

@gaev has asked me to publish this script from him as the security system rejects it:

{NeoBook Function}
Version=5.80
Language=VBScript
Param=[%1]|Text|firstString
Param=[%2]|Text|secondString
Param=[%3]|Variable|result
{End}
intCompare = StrComp("[%1]","[%2]",0)
' MsgBox "[%1]" & " - " & "[%2]" & " - " & intCompare
If intCompare = -1 Then
   compareResult = "isLessThan"
End If
If intCompare = 0 Then
   compareResult = "isEqual"
End If
If intCompare = 1 Then
   compareResult = "isGreaterThan"
End If
' MsgBox compareResult

publication.nbSetVar "[%3]", compareResult

He will add some comments soon.
Thanks!

Uploaded files:
  • You need to login to have access to uploads.
Vadim has reacted to this post.
Vadim

@gaev

Thanks for the helpful input !!

Thanks @luishp for loading the file on the forum.

If you want to Call this Function in any of your Publications, just save it in the VisualNEOWin Functions folder.

After that, any time you need case-sensitive compares, do something like this ...

SetVar "[strA]" "abcd"
SetVar "[strB]" "ABCD"
Call "CaseSensitiveIf" "[strA]" "[StrB]" "[resultVariable]"
AlertBox "compareResult" "[strA][#13][resultVariable][#13][strB]"

[resultVariable] will contain one of ...

isLessThan
isEqual
isGreaterThan

Happy comparing !

Vadim has reacted to this post.
Vadim
Open chat
1
Do you need more info?
Hi, do you have any doubt?