StringByteLength()

Syntax

Result = StringByteLength(String$ [, Format])
Description
Returns the number of bytes required to store the string in memory in a given format.

Parameters

String$ The string to use.
Format (optional) The destination format to use. It can be one of the following value:
  #PB_Ascii  : Ascii format
  #PB_UTF8   : UTF8 format
  #PB_Unicode: UTF16 format
If omitted, the mode of the executable (unicode or ascii) is used.

Return value

The number of bytes required to store the string in memory in a given format.

Remarks

The number of bytes returned does not include the terminating Null-Character of the string. The size of the Null-Character is 1 byte for Ascii and UTF8 mode and 2 bytes for Unicode mode.

Example

  Debug StringByteLength("รค", #PB_UTF8) ; will display 2

Supported OS

All

<- StrU() - String Index - StringField() ->