module
Tessell::Kit::Graphemes
Defined in:
tessell/kit/graphemes.crClass Method Summary
-
.boundaries(text : String) : Array(Int32)
返回 UTF-8 byte 边界,包含 0 与 text.bytesize。
-
.clamp(text : String, position : Int32) : Int32
光标位置近似:返回距离 position 最近的合法边界(偏向左侧)。
- .count(text : String) : Int32
- .next_boundary(text : String, position : Int32) : Int32
- .next_boundary(bounds : Array(Int32), position : Int32) : Int32
- .prev_boundary(text : String, position : Int32) : Int32
- .prev_boundary(bounds : Array(Int32), position : Int32) : Int32