-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtext.lua
More file actions
51 lines (42 loc) · 1.63 KB
/
text.lua
File metadata and controls
51 lines (42 loc) · 1.63 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
---@meta
--- OpenComputers Text API
---
--- Provides general string operations and data serialization utilities.
---@class TextLib
local text = {}
--- Converts tabs in a string to spaces, aligning to tabWidth.
---@param value string Input string
---@param tabWidth number Tab width
---@return string String with tabs replaced by spaces
function text.detab(value, tabWidth) end
--- Pads a string with whitespace on the right up to the specified length.
---@param value string Input string
---@param length number Target length
---@return string Right-padded string
function text.padRight(value, length) end
--- Pads a string with whitespace on the left up to the specified length.
---@param value string Input string
---@param length number Target length
---@return string Left-padded string
function text.padLeft(value, length) end
--- Removes whitespace from the start and end of a string.
---@param value string Input string
---@return string Trimmed string
function text.trim(value) end
--- Wraps the provided string to the specified width.
---@param value string Input string
---@param width number Wrap width
---@param maxWidth number Maximum width
---@return string[] Wrapped lines
function text.wrap(value, width, maxWidth) end
--- Returns a wrapper function around text.wrap.
---@param value string Input string
---@param width number Wrap width
---@param maxWidth number Maximum width
---@return function Wrapper function
function text.wrappedLines(value, width, maxWidth) end
--- Splits the input string into a table using space as the delimiter.
---@param value string Input string
---@return table Tokens
function text.tokenize(value) end
return text