VBScript StrComp関数
完全な VBScript リファレンスマニュアル
StrComp 関数は2つの文字列を比較し、比較結果を表す値を返します。
StrComp 関数は次の値を返すことができます:
- -1 (string1 < string2 の場合)
- 0 (string1 = string2 の場合)
- 1 (string1 > string2 の場合)
- Null (string1 または string2 が 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 リファレンスマニュアル その他の拡張