import { strchars } from "https://deno.land/x/denops_std@v5.0.2/function/mod.ts";
The result is a Number, which is the number of characters
in String {string}.
When {skipcc} is omitted or zero, composing characters are
counted separately.
When {skipcc} set to 1, Composing characters are ignored.
strcharlen()
always does this.
Returns zero on error.
Also see strlen()
, strdisplaywidth()
and strwidth()
.
{skipcc} is only available after 7.4.755. For backward compatibility, you can define a wrapper function:
if has("patch-7.4.755")
function s:strchars(str, skipcc)
return strchars(a:str, a:skipcc)
endfunction
else
function s:strchars(str, skipcc)
if a:skipcc
return strlen(substitute(a:str, ".", "x", "g"))
else
return strchars(a:str)
endif
endfunction
endif
Can also be used as a method
:
GetText()->strchars()