Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/denops_std/function/vim/mod.ts>strutf16len

📚 Standard module for denops.vim
Go to Latest
function strutf16len
import { strutf16len } from "https://deno.land/x/denops_std@v6.3.0/function/vim/mod.ts";

The result is a Number, which is the number of UTF-16 code units in String {string} (after converting it to UTF-16).

When {countcc} is TRUE, composing characters are counted separately. When {countcc} is omitted or FALSE, composing characters are ignored.

Returns zero on error.

Also see strlen() and strcharlen(). Examples:

echo strutf16len('a')               returns 1
echo strutf16len('©')               returns 1
echo strutf16len('😊')               returns 2
echo strutf16len('ą́')             returns 1
echo strutf16len('ą́', v:true)     returns 3

Can also be used as a method:

GetText()->strutf16len()

Parameters

denops: Denops
string: unknown
optional
countcc: unknown

Returns

Promise<number>