Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

sizeBytes string

sizeBytes is NOT undoable, NOT queryable, and NOT editable.

This command returns the size in bytes of a string.

Use of this command is discouraged. The size command which returns the number of characters in the string should be used instead in most situations where string length needs to be determined. It is important to note that the size in bytes of the string will not always correspond to the number of characters in the string.

The sizeBytes value is determined by the number of bytes in the internal representation of the mel string. It is generally the storage length of the string as represented in the native multibyte encoding, although this is subject to change in future. The value returned is therefore dependent on the locale in effect and the results will differ across platforms and locales. Scripts written to use this value may as a result have unreliable behaviour.

Return value

intString size

Related

size

MEL examples

string $myString = "a string";
$strSize=sizeBytes($myString);
// Result: 8 //