Compares two strings with options.
StringCompare ( "string1", "string2" [, casesense = 0] )
string1 | The first string to evaluate. |
string2 | The second string to evaluate. |
casesense | [optional] Flag to indicate if the operations should be case sensitive. $STR_NOCASESENSE (0) = not case sensitive, using the user's locale (default) $STR_CASESENSE (1) = case sensitive $STR_NOCASESENSEBASIC (2) = not case sensitive, using a basic/faster comparison Constants are defined in StringConstants.au3. |
0: | string1 and string2 are equal |
> 0: | string1 is greater than string2 |
< 0: | string1 is less than string2 |
StringInStr, StringLeft, StringLen, StringLower, StringMid, StringRight, StringTrimLeft, StringTrimRight, StringUpper
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
Local $sStr1 = "Tiësto"
Local $sStr2 = "TIËSTO"
; Compare two strings without using case sensitivity.
Local $iCmp = StringCompare($sStr1, $sStr2)
MsgBox($MB_SYSTEMMODAL, "", _
"Comparing '" & $sStr1 & "' To '" & $sStr2 & "'" & @CRLF & _
"StringCompare Result (mode $STR_NOCASESENSE): " & $iCmp)
; Compare two strings with using case sensitivity.
$iCmp = StringCompare($sStr1, $sStr2, $STR_CASESENSE)
MsgBox($MB_SYSTEMMODAL, "", _
"Comparing '" & $sStr1 & "' To '" & $sStr2 & "'" & @CRLF & _
"StringCompare Result (mode $STR_CASESENSE): " & $iCmp)
; Compare two strings without using case sensitivity.
$iCmp = StringCompare($sStr1, $sStr2, $STR_NOCASESENSEBASIC)
MsgBox($MB_SYSTEMMODAL, "", _
"Comparing '" & $sStr1 & "' To '" & $sStr2 & "'" & @CRLF & _
"StringCompare Result (mode $STR_NOCASESENSEBASIC): " & $iCmp)