Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Show menu Show menu

ULEN function


Length of string function. ULEN(str) returns the number of characters in the string str.


ULEN(A20) returns 1 if cell A20 contains the string "𠜎".



Unicode and UTF-16 encoding

MedCalc stores strings using UTF-16 character encoding. The ULEN function returns the actual number of characters in the string. This number can be different than the number of UTF-16 code units (16-bit units) used to store the string, notably when the string contains characters in the Unicode range U+10000 to U+10FFFF.

The number of UTF-16 code units is returned by the LEN function.

For example, for the Unicode character U+2070E (𠜎), ULEN("𠜎") returns 1 and LEN("𠜎") returns 2.

Use the LEN function when you need the length of a string in other string functions such as the LEFT(str,n), MID(str,pos,n), or RIGHT(str,n) functions.

Related functions

External links