Compare Method for LCStream

This method compares two LCStream objects to determine if they are equal or unequal. If the streams are of different formats, they will first be converted to the same format. If both streams are text, they may be converted to Unicode for comparison. In a text comparison, if either stream has the flag LCSTREAMF_NO_CASE set, then a case-insensitive text comparison will be done.

Defined In

LCStream

Syntax

result = thisStream. Compare (baseStream)

Parameters

Parameter

Description

baseStream

LCStream. The stream to which to compare this stream.

Return Value

Value

Description

result

Long. Result of the comparison:

Result > 0 (positive) -- thisStream is greater than baseStream.

Result < 0 (negative) -- thisStream is less than baseStream.

Result = 0 -- thisStream is equal to baseStream.

Example

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

Example Output

The first string is the same as the second.