LCStream の ResetFormat メソッド

このメソッドは、LCStream オブジェクトの形式を設定し直します。データや他のプロパティには影響しません。形式を変更してデータも変換する SetFormat とは異なります。

このメソッドは、複数言語の文字列を単一のデータベースに保存し、形式を切り替える必要がある場合に便利です。例えば、アプリケーションにさまざまな国からブラウザによってアクセスするため、各言語にコンテンツを変換しなければならない場合などです。このとき、各国語への変換結果を単一のデータベースに保存します。ほとんどのリレーショナルデータベース管理システム (RDBMS) 環境では単一のデータベースに複数言語を保存できないため、変換結果をキーによって選択します。コンテンツは BLOB として扱い、形式を正しいキャラクタセットに設定し直してから Web ブラウザに渡します。

関連情報については、形式を変更してデータも変換する SetFormat メソッドを参照してください。

定義位置

LCStream

構文

Call lcStream. ResetFormat (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 is " & msg.Length
  Call msg.ResetFormat (LCSTREAMFMT_UNICODE)
  Print "The length of the msg and its contents have not changed but the format is now Unicode"
  Print "The length of the msg is " & msg.Length
  REM msg.Text at this point does not contain a useful value, because 
  REM the Unicode character set uses two bytes per character and 
  REM the message has not been converted to this format.
End Sub

出力例

The length of the msg is 36
The length of the msg and its contents have not changed but the format is now Unicode
The length of the msg is 36