-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunicode.lua
More file actions
63 lines (51 loc) · 1.79 KB
/
unicode.lua
File metadata and controls
63 lines (51 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---@meta
--- OpenComputers Unicode API
---
--- Provides UTF-8 aware string manipulation utilities.
---@class UnicodeLib
local unicode = {}
--- UTF-8 aware version of string.char.
---@param value number Codepoint
---@param ... number Additional codepoints
---@return string UTF-8 string
function unicode.char(value, ...) end
--- Returns the width of the first character in the string.
---@param value string Input string
---@return number Character width
function unicode.charWidth(value, ...) end
--- Returns true if the first character is wide (width > 1).
---@param value string Input string
---@return boolean True if wide
function unicode.isWide(value, ...) end
--- UTF-8 aware version of string.len.
---@param value string Input string
---@return number Character count
function unicode.len(value) end
--- UTF-8 aware version of string.lower.
---@param value string Input string
---@return string Lowercase string
function unicode.lower(value) end
--- UTF-8 aware version of string.reverse.
---@param value string Input string
---@return string Reversed string
function unicode.reverse(value) end
--- UTF-8 aware version of string.sub.
---@param value string Input string
---@param i number Start index
---@param j number? End index (optional)
---@return string Substring
function unicode.sub(value, i, j) end
--- UTF-8 aware version of string.upper.
---@param value string Input string
---@return string Uppercase string
function unicode.upper(value) end
--- Returns the width of the entire string.
---@param value string Input string
---@return number String width
function unicode.wlen(value) end
--- Truncates the string to the specified width.
---@param value string Input string
---@param count number Width to truncate to
---@return string Truncated string
function unicode.wtrunc(value, count) end
return unicode