Handlebar Helper Function: Char
Returns the Unicode character that corresponds to a specified character code. The function can optionally repeat the character a specified number of times.
| Parameter | Type | Description |
|---|---|---|
code | number or string | Required. The Unicode character code, in decimal notation. Must be a number or convertible to a number. |
repeated | number or string | The number of times to repeat the character. Must be a number or convertible to a number. The default value is 1. |
The function returns the Unicode character that corresponds to the provided code. If a repeat count is specified, it returns the character that many times. For both parameters, the function attempts to convert strings to numbers.
The function throws an exception if the repeated parameter is negative. The function also throws an exception if the value of either parameter isn't a number or convertible to a number.
If the value of the code parameter is outside the 16-bit range (0-65535), the function wraps it around to a valid Unicode value by taking the modulo of the value and 65536. For example, {{char 65602 1}} returns B (U+0042), because 65602 % 65536 is 66 in decimal notation or 42 in hexadecimal.