StringCompare
比较两个字符串.
StringCompare ( "string1", "string2" [, casesense = 0] )
参数
string1
|
比较的第一个字符串
|
string2
|
比较的第二个字符串
|
casesense
|
[可选] 指定区分大小写的比较方式.
$STR_NOCASESENSE (0) = 不区分大小写,使用用户区域设置 (默认)
$STR_CASESENSE (1) = 区分大小写
$STR_NOCASESENSEBASIC (2) = 不区分大小写, 使用基本/快速比较方法
常量定义在 StringConstants.au3
|
返回值
返回值=0:
|
字符串1 与 字符串2 相等
|
> 0:
|
字符串1 大于 字符串2
|
< 0:
|
字符串1 小于 字符串2
|
函数示例
#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)
----------------------------------------
该函数可以通过命令 exect 调用
参见:
StringInStr, StringLen, StringLeft, StringRight, StringTrimLeft, StringTrimRight
StringCompare('MELУN','melуn')
StringCompare('MELУN','melуn',1)
StringCompare('MELУN','melуn',2)
exect=$var_n1=StringCompare('MELУN','melуn')||$var_n2=StringCompare('MELУN','melуn',1)||$var_n3=StringCompare('MELУN','melуn',2) GLOBALEXECT<a> ;; 比较两行使用附加参数
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|