LCStream の SetFormat メソッド

このメソッドは、LCStream オブジェクトの形式を設定し、必要に応じてストリームデータを変換します。このメソッドでは 2 つ目のストリームが必要ないため、Convert メソッドより効率的です。

定義位置

LCStream

構文

Call lcStream .setFormat (format)

パラメータ

パラメータ

説明

format

Long。ストリームオブジェクトに設定する形式です。ストリームの形式のリストについては、この章の「ストリーム形式」を参照してください。データはこのストリーム形式に変換されます。

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim msg As New LCStream (0, 0, LCSTREAMFMT_ASCII)
  msg.Text = "Peter Pan lived in Never Never Land."
  Print "The length of the msg in ASCII is " & msg.Length
  Call msg.SetFormat (LCSTREAMFMT_UNICODE)
  Print "The length of the msg in Unicode is " & msg.Length
End Sub

出力例

The length of the msg in ASCII is 36.
The length of the msg in Unicode is 72.