ByteCount Function

Official Content

This function is used to get the numbers of bytes needed to represent a specific character expression using a specific encoding.

Syntax

Ret-value = ByteCount(character-expression , encoding);

Type Returned:

Numeric

Where:

Character-expression
Character type. Is the input string.

Encoding
Character type. Is the encoding to be used.

Ret-value
Numeric type. Is the number of bytes needed to represent the given character expression with the specified encoding.

Example

Suppose we want to know how many bytes are needed to represent "hello world" using the UTF-8 encoding.

&charVar = 'hello world'
&encoding = 'UTF-8'
&result = byteCount(&charVar,&encoding)

The value of &result will be 11 because in UTF-8 a character is stored in a byte.

Scope

Objects: Procedures, Reports, Transactions, Web Panels, Work Panels.
Languages: .NET, Java, .NET Mobile(1), iOS(2)

Notes

- Up to GeneXus X Evolution 3
2 - iOS offline support is available since GeneXus #15.

See Also

Java supported encodings
.NET supported encodings

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.