Extract Method for LCStream

This method creates a stream from part of the data of an existing stream.

Since this method works off of byte counts, it is most useful if you know you have single or double byte character sets. It's not as useful if there's a mix, like LMBCS or CodePage932 (mix of single-byte and double-byte character sets).

Defined In

LCStream

Syntax

Call lcStream. Extract (srcStream, offset, length)

Parameters

Parameter

Description

srcStream

LCStream. Stream supplying the data from which the new stream is created.

offset

Long. Byte position in srcStream of the start of the new stream. If the offset exceeds the length of the stream data, the new stream is cleared.

length

Long. Length in bytes of the new stream copied from srcStream. If the length copies more bytes than are available, the copy stops at the end of the source data.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim msg As New LCStream (, , LCSTREAMFMT_ASCII)
  Dim part As New LCStream
  msg.Text = "the quick brown fox jumped over the lazy dog"
  Call part.Extract (msg, 11, 5)
  Print "The 5 bytes, starting at the 11th byte, is " & part.Text
End Sub

Example Output

The 5 bytes, starting at the 11th byte, is brown.