Standard (built-in) string comparison operators are:
They are only capable of telling whether two strings are equal or not. They don't provide information on which string is greater or less, if strings differ.
LogicLib plug-in extends this set of comparison operators with following ones:
Note that operators with capital letter S are case-sensitive.
Here are some tests:
Output:
- case-insensitive: ==, !=, StrCmp
- case-sensitive: StrCmpS
They are only capable of telling whether two strings are equal or not. They don't provide information on which string is greater or less, if strings differ.
LogicLib plug-in extends this set of comparison operators with following ones:
- case-insensitive: <, <=, >, >=
- case-sensitive: S==, S!=
Note that operators with capital letter S are case-sensitive.
Here are some tests:
StrCpy $0 "abc"
StrCpy $1 "abc"
StrCpy $2 "Abc"
StrCpy $3 "bbc"
${If} $0 == $1
DetailPrint "Equal to $1"
${Else}
DetailPrint "Not equal to $1"
${EndIf}
${If} $0 == $2
DetailPrint "Equal to $2"
${Else}
DetailPrint "Not equal to $2"
${EndIf}
; case sensitive comparison (LogicLib operator)
${If} $0 S== $2
DetailPrint "Equal to $2"
${Else}
DetailPrint "Not equal to $2"
${EndIf}
${If} $0 == $3
DetailPrint "Equal to $3"
${Else}
DetailPrint "Not equal to $3"
${EndIf}
${If} $0 S< $2
DetailPrint "Less than $2"
${Else}
DetailPrint "Greater or equal than $2"
${EndIf}
${If} $0 S< $3
DetailPrint "Less than $3"
${Else}
DetailPrint "Greater or equal than $3"
${EndIf}
StrCpy $1 "abc"
StrCpy $2 "Abc"
StrCpy $3 "bbc"
${If} $0 == $1
DetailPrint "Equal to $1"
${Else}
DetailPrint "Not equal to $1"
${EndIf}
${If} $0 == $2
DetailPrint "Equal to $2"
${Else}
DetailPrint "Not equal to $2"
${EndIf}
; case sensitive comparison (LogicLib operator)
${If} $0 S== $2
DetailPrint "Equal to $2"
${Else}
DetailPrint "Not equal to $2"
${EndIf}
${If} $0 == $3
DetailPrint "Equal to $3"
${Else}
DetailPrint "Not equal to $3"
${EndIf}
${If} $0 S< $2
DetailPrint "Less than $2"
${Else}
DetailPrint "Greater or equal than $2"
${EndIf}
${If} $0 S< $3
DetailPrint "Less than $3"
${Else}
DetailPrint "Greater or equal than $3"
${EndIf}
Output:
Equal to abc.
Equal to Abc.
Not equal to Abc.
Not equal to bbc.
Greater or equal than Abc.
Less than bbc.
Equal to Abc.
Not equal to Abc.
Not equal to bbc.
Greater or equal than Abc.
Less than bbc.
No comments:
Post a Comment