LCStream の Compare メソッド

このメソッドは、2 つの LCStream オブジェクトを比較し、等しいか等しくないかを判別します。2 つのストリームの形式が異なる場合は、まず同じ形式に変換されます。ストリームがどちらもテキストの場合は、比較するために Unicode に変換されることがあります。テキストを比較するとき、いずれかのストリームに LCSTREAMF_NO_CASE フラグが設定されている場合は、大文字と小文字が区別されません。

定義位置

LCStream

構文

result = thisStream. Compare (baseStream)

パラメータ

パラメータ

説明

baseStream

LCStream。thisStream と比較するストリームです。

戻り値

説明

結果

Long。比較の結果 (以下のいずれか)。

 

Result > 0 (正) -- thisStreambaseStream より大きい。

 

Result < 0 (負) -- thisStreambaseStream より小さい。

 

Result = 0 -- thisStreambaseStream と等しい。

Option Public
Option Explicit
Uselsx "*lsxlc" 
Sub Initialize
  Dim stream1 As New LCStream (64, LCSTREAMF_NO_CASE, LCSTREAMFMT_ASCII)
  Dim stream2 As New LCStream (64, , LCSTREAMFMT_ASCII)
  Dim match As Long
  stream1.Text = "The quick brown fox"
  stream2.Text = "the QuiCK BROWn fOX"
  match = stream1.Compare (stream2)
  If (match = 0) Then
    Print "The first string is the same as the second."
  Elseif (match > 0) Then
    Print "The first string comes before the second."
  Else
    Print "The first string comes after the second."
  End If
End Sub

出力例

The first string is the same as the second.