Meaning#
A byte sequence. Lua 5.1 #text counts bytes, not UTF-8 characters. Concatenate strings with .. .
Example#
local text = "ship"
local upper = string.upper(text)
local same = text:upper()
local joined = text .. "_name"What happens: upper = "SHIP", same = "SHIP", joined = "ship_name"; the original text remains "ship".
This fragment does not print or write a log message. The values shown are the expected results of the example.
Methods and related calls#
| Function | Returns | Purpose |
|---|---|---|
| string.byte | number, ... |
Returns numeric byte values for the selected string range. |
| string.char | string |
Constructs a string from numeric byte values. |
| string.find | (number, number, ...) | nil |
Returns match start/end positions followed by pattern captures, or nil when unmatched. |
| string.format | string |
Builds a string from a format specification and supplied values. |
| string.gmatch | function |
Returns a Lua-pattern match iterator; Lua patterns are distinct from PCRE regular expressions. |
| string.lower | string |
Returns a lowercase copy; it is not a general Unicode case converter. |
| string.rep | string |
Returns a string repeated the requested number of times. |
| string.upper | string |
Returns an uppercase copy; it is not a general Unicode case converter. |