1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
"http://www.w3.org/TR/html4/strict.dtd"> |
3 |
<html> |
<html> |
4 |
<head> |
<head> |
5 |
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> |
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> |
6 |
<title>strcompare</title> |
<title>strcompare</title> |
7 |
<meta http-equiv="Content-Style-Type" content="text/css"> |
<meta http-equiv="Content-Style-Type" content="text/css"> |
8 |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
9 |
</head> |
</head> |
10 |
|
|
11 |
<body> |
<body> |
12 |
|
|
13 |
|
|
14 |
<h1>strcompare</h1> |
<h1>strcompare</h1> |
15 |
|
|
16 |
<p> |
<p> |
17 |
文字列を比較する。 |
文字列を比較する。 |
18 |
</p> |
</p> |
19 |
|
|
20 |
<h2>形式</h2> |
<h2>形式</h2> |
21 |
|
|
22 |
<pre class="macro-syntax"> |
<pre class="macro-syntax"> |
23 |
strcompare <string1> <string2> |
strcompare <string1> <string2> |
24 |
</pre> |
</pre> |
25 |
|
|
26 |
<h2>解説</h2> |
<h2>解説</h2> |
27 |
|
|
28 |
<p> |
<p> |
29 |
2つの文字列 <string1>, <string2> を比較し、結果をシステム変数 result に代入する。<br> |
2つの文字列 <string1>, <string2> を比較し、結果をシステム変数 result に代入する。<br> |
30 |
文字列の文字コード表現を符号なし整数(最初の文字が最上位バイト)とみなし、2つの文字列に対応する整数値の大小関係を求め、それに応じて以下のようにresult の値が決定される。 |
文字列の文字コード表現を符号なし整数(最初の文字が最上位バイト)とみなし、2つの文字列に対応する整数値の大小関係を求め、それに応じて以下のようにresult の値が決定される。 |
31 |
</p> |
</p> |
32 |
|
|
33 |
<table> |
<table> |
34 |
<tr> |
<tr> |
35 |
<th>大小関係</th> |
<th>大小関係</th> |
36 |
<th>resultの値</th> |
<th>resultの値</th> |
37 |
</tr> |
</tr> |
38 |
<tr> |
<tr> |
39 |
<td><string1> < <string2></td> |
<td><string1> < <string2></td> |
40 |
<td>-1</td> |
<td>-1</td> |
41 |
</tr> |
</tr> |
42 |
<tr> |
<tr> |
43 |
<td><string1> = <string2></td> |
<td><string1> = <string2></td> |
44 |
<td>0</td> |
<td>0</td> |
45 |
</tr> |
</tr> |
46 |
<tr> |
<tr> |
47 |
<td><string1> > <string2></td> |
<td><string1> > <string2></td> |
48 |
<td>1</td> |
<td>1</td> |
49 |
</tr> |
</tr> |
50 |
</table> |
</table> |
51 |
|
|
52 |
<h2>例</h2> |
<h2>例</h2> |
53 |
|
|
54 |
<pre class="macro-example"> |
<pre class="macro-example"> |
55 |
; result = -1 |
; result = -1 |
56 |
strcompare 'abc' 'def' |
strcompare 'abc' 'def' |
57 |
|
|
58 |
strcompare command 'next' |
strcompare command 'next' |
59 |
if result=0 goto label |
if result=0 goto label |
60 |
strcompare command 'end' |
strcompare command 'end' |
61 |
if result=0 end |
if result=0 end |
62 |
</pre> |
</pre> |
63 |
|
|
64 |
</body> |
</body> |
65 |
</html> |
</html> |