import { fn } from "https://deno.land/x/ddc_vim@v3.8.0/deps.ts";
const { nr2char } = fn;
Return a string with a single character, which has the number value {expr}. Examples:
nr2char(64) returns "@"
nr2char(32) returns " "
When {utf8} is omitted or zero, the current 'encoding' is used. Example for "utf-8":
nr2char(300) returns I with bow character
When {utf8} is TRUE, always return UTF-8 characters. Note that a NUL character in the file is specified with nr2char(10), because NULs are represented with newline characters. nr2char(0) is a real NUL and terminates the string, thus results in an empty string. To turn a list of character numbers into a string:
let list = [65, 66, 67]
let str = join(map(list, {_, val -> nr2char(val)}), '')
Result: "ABC"
Can also be used as a method
:
GetNumber()->nr2char()