Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)

Tags: string handling

# Description

The LEN function returns the character length of the supplied expression. It takes the general form:


Where expression can evaluate to any type and the function will convert it to a string automatically.

The LEN() function when used in International Mode will return the number of characters in the specified expression rather than the number of bytes. If the expression consists entirely of UTF-8 characters in the ASCII range 0 – 127 then the character length of the expression will equate to the byte length. However, when the expression contains characters outside the ASCII range 0 – 127 then byte length and character length will differ.

# Note

If the byte length is specifically required then it is recommended that the BYTELEN function be used in place of the LEN function. It is also not recommended to use programs manipulating byte counts in International Mode.

An example of use may be as:

string_Val= "qwerty"
CRT LEN(string_Val)

to display 6.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide