module Tessell::Kit::Graphemes

Defined in:

tessell/kit/graphemes.cr

Class Method Summary

Class Method Detail

def self.boundaries(text : String) : Array(Int32) #

返回 UTF-8 byte 边界,包含 0 与 text.bytesize。


[View source]
def self.clamp(text : String, position : Int32) : Int32 #

光标位置近似:返回距离 position 最近的合法边界(偏向左侧)。


[View source]
def self.count(text : String) : Int32 #

[View source]
def self.next_boundary(text : String, position : Int32) : Int32 #

[View source]
def self.next_boundary(bounds : Array(Int32), position : Int32) : Int32 #

[View source]
def self.prev_boundary(text : String, position : Int32) : Int32 #

[View source]
def self.prev_boundary(bounds : Array(Int32), position : Int32) : Int32 #

[View source]