Procs
proc wcswidth(str: string; ambiguousIsWide: bool = false): int {....raises: [], tags: [].}
-
return the width of string if ambiguousIsWide = true, ambiguous character will be counted as 2.
Example:
doAssert "コンニチハ世界".wcswidth == 14 doAssert "Pokémon GETだぜ!".wcswidth == 17
proc wcwidth(c: Rune; ambiguousIsWide: bool = false): int {....raises: [], tags: [].}
-
return the width of a single unicode character if ambiguousIsWide = true, ambiguous character will be 2.
Example:
import std/unicode doAssert "a".runeAt(0).wcwidth == 1 doAssert "湯".runeAt(0).wcwidth == 2 doAssert "\u0301".runeAt(0).wcwidth == 0 doAssert "\u0301".runeAt(0).wcwidth(ambiguousIsWide = true) == 2