VBScriptのStrComp関数機能
StrComp関数の機能は、2つの文字列を比較し、比較結果を表す値を返します。
StrComp関数関数は次の値を返すことができます。
- 1(文字列1の場合<文字列2)
- 0(もし文字列1 =文字列2)
- 1(文字列1> string2の場合)
- ヌル(文字列1または文字列2がNULLの場合)
文法
StrComp(string1,string2[,compare])
参数 | 描述 |
---|---|
string1 | 必需。字符串表达式。 |
string2 | 必需。字符串表达式。 |
compare | 可选。规定要使用的字符串比较类型。默认是 0。 可采用下列的值:
|
例1
document.write(StrComp("VBScript","VBScript"))
Output:
0
Output:
0
例2
document.write(StrComp("VBScript","vbscript"))
Output:
-1
Output:
-1
例3
document.write(StrComp("VBScript","vbscript",1))
Output:
0
Output:
0
完全なVBScriptのリファレンス