ResetFormat Method for LCStream

This method resets the format of an LCStream object, without affecting the data or other properties. This differs from SetFormat, which changes the format and also converts the data.

This method may be useful when storing multiple language strings in a single database and you need to switch the format. A typical case would be Web browsers accessing an application from different countries and requiring different translations of the content. The different translations could be stored in a single database. Since most relational database management system (RDBMS) environments do not permit multiple languages within a single database, the translations could be selected based on a key. The contents would be treated as blobs and the format would be reset to the correct character set before being passed to the Web browser.

For related information, see the SetFormat method, which changes the format and also converts the data.

Defined In

LCStream

Syntax

Call lcStream. ResetFormat (format)

Parameters

Parameter

Description

format

Long. The new format for the stream object. See the list of stream formats in the section entitled "Stream Formats" earlier in this chapter.

Example

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

Example Output

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