Jump to content

Documentation/Calc Functions/UNICHAR

From The Document Foundation Wiki


Function name:

UNICHAR

Category:

Text

Summary:

Determines the character that corresponds to a given Unicode code point. In some cases, the character returned by UNICHAR may be a non-printing character that is not readily visible (for example control characters).

The UNICHAR function is complementary to the UNICODE function.

For some code points in the range 0 ≤ n ≤ 255, UNICHAR may return the same character as the CHAR function. However, for other code points in the same range, the character returned my be different when CHAR returns a system-specific character from the current coded character set.

Syntax:

UNICHAR(Number)

Returns:

Returns the single character that corresponds to the given UNICODE code point.

Arguments:

Number is an integer in the range 0 ≤ n ≤ 111411 (0x10FFF in hexadecimal), or a reference to a cell containing such an integer, that is the code point of the character that is required.

  • If Number is non-numeric, then UNICHAR reports a #VALUE! error.
  • For a non-integer value of Number, UNICHAR truncates the value to an integer.
  • If, after any truncation, Number is less than 0 or greater than 111411, then UNICHAR reports an invalid argument error (Err:502).

Additional details:

For any code point n, n = UNICODE(UNICHAR(n))

Examples:

Formula Description Returns
=UNICHAR(65) Here the function returns the uppercase A character. A
=UNICHAR(D1) where cell D1 contains the number 122. Here the function returns the lowercase z character. z
=UNICHAR(HEX2DEC("3B")) It is common to refer to code points in hexadecimal notation. Here the function returns the semicolon character. The code point for the semicolon is 3B in hexadecimal notation, 59 in decimal. ;
="abc" & UNICHAR(10) & "def" Here UNICHAR(10) returns the line feed character. On a Windows computer this formula should insert a newline between the two strings (refer to Wikipedia's Newline page for more information about how newlines are handled in various environments). abc
def
=UNICHAR(HEX2DEC("2230")) Here the function returns the mathematical symbol for a volume integral.
=UNICHAR(HEX2DEC("1F642")) Here the function returns a "slightly smiling face" emoticon - the UNICODE character repertoire is extremely rich! 🙂

Related LibreOffice functions:

CHAR

CODE

UNICODE

ODF standard:

Section 6.20.25, part 2

Related (or similar) Excel functions:

UNICHAR since v.2013.