SysUtilsByteLength (C++)

From RAD Studio Code Examples
Jump to: navigation, search


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.


int _tmain(int argc, _TCHAR* argv[])
	UnicodeString s1;

	/* Assign the string. */
	s1 = "Hello World!";

	/* Print to the console the character length and the byte length of the
	   UnicodeString. */
	printf("UnicodeString: %s contains %d, characters in %d bytes.\n",
		s1, s1.Length(), ByteLength(s1));

	return 0;