SysUtilsByteLength (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example illustrates the ByteLength function from the SysUtils unit. The application prints to the console the number of characters and the length in bytes of the string passed as parameter.

Code

var
  LS1: WideString;

begin
  { Assign the string. }
  LS1 := 'Hello World!';

	{ Print to the console the character length and the byte length of the
	   UnicodeString. }
  Writeln('UnicodeString: ''', LS1, ''' contains ', Length(LS1),
    ' characters in ', ByteLength(LS1), ' bytes.');
  Readln;
end.

Uses

Personal tools
Assistance