StrUnicode2Ansi Function

Action

Converts a string from unicode representation to single byte representation.

Include file

Kernel.bdh

Syntax

StrUnicode2Ansi( out sAnsi      : string,
                 in  nAnsiBytes : number,
                 in  sUnicode   : string,
                 in  nByteOrder : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sAnsi String receiving the single-byte representation.
nAnsiBytes Number of bytes to be used in sAnsi.
sUnicode String in unicode representation that is to be converted.
nByteOrder

Number (optional) which declares if the Unicode is in little endian or in big endian. Possible values are:

  • OPT_LITTLE_ENDIAN. Specifies little endian byte order. (default)

  • OPT_BIG_ENDIAN. Specifies big endian byte order.

Example

dcltrans
  transaction TMain
  var
    sAnsi, sUnicode: string;
  begin
    sAnsi := "hello world!";
    StrAnsi2Unicode(sUnicode, STRING_COMPLETE, sAnsi);
    writeln(StrUnicodeLen(sUnicode));
    StrUnicode2Ansi(sAnsi, STRING_COMPLETE, sUnicode);
  end TMain;