Skip to main content
Module

x/ddc_vim/deps.ts>fn.char2nr

Dark deno-powered completion framework for neovim/Vim8
Go to Latest
function fn.char2nr
import { fn } from "https://deno.land/x/ddc_vim@v0.0.13/deps.ts";
const { char2nr } = fn;

Return number value of the first char in {expr}. Examples: char2nr(" ") returns 32 char2nr("ABC") returns 65 When {utf8} is omitted or zero, the current 'encoding' is used. Example for "utf-8": char2nr("á") returns 225 char2nr("á"[0]) returns 195 With {utf8} set to 1, always treat as utf-8 characters. A combining character is a separate character. |nr2char()| does the opposite. To turn a string into a list of character numbers: let str = "ABC" let list = map(split(str, '\zs'), {_, val -> char2nr(val)}) Result: [65, 66, 67] Can also be used as a |method|: GetChar()->char2nr()

Parameters

denops: Denops
expr: unknown
optional
utf8: unknown

Returns

Promise<unknown>