class Wiris::Utf8

Public Class Methods

charAt(s, i) click to toggle source
# File lib/src-generic/Utf8.rb, line 23
def self.charAt(s, i)
        return s[i]
end
charCodeAt(s, index) click to toggle source
# File lib/src-generic/Utf8.rb, line 11
def self.charCodeAt(s, index)
        return s.codepoints.to_a[index]
end
fromBytes(bytes) click to toggle source
# File lib/src-generic/Utf8.rb, line 7
def self.fromBytes(bytes)
        return bytes.pack("C*")
end
getLength(s) click to toggle source
# File lib/src-generic/Utf8.rb, line 19
def self.getLength(s)
        return s.length
end
toBytes(str) click to toggle source
# File lib/src-generic/Utf8.rb, line 3
def self.toBytes(str)
        return str.force_encoding("UTF-8").bytes.to_a
end
uchr(code) click to toggle source
# File lib/src-generic/Utf8.rb, line 15
def self.uchr(code)
        return code.chr(Encoding::UTF_8)
end