Difference between revisions of "String"
m |
|||
Line 12: | Line 12: | ||
'''The string library assumes one-byte character encodings''' | '''The string library assumes one-byte character encodings''' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | '''TO DO''': test and add missing Luau String functions from '''https://create.roblox.com/docs/reference/engine/libraries/string''', like '''pack''', '''packsize''', '''split''', '''unpack''', '''...''' | ||
+ | |||
{|- | {|- |
Revision as of 23:59, 9 January 2023
Supported platforms:
Available since: Gideros 2011.6
Description
This library provides generic functions for string manipulation, such as finding and extracting substrings, and pattern matching.
When indexing a string in Lua, the first character is at position 1 (not at 0, as in C). Indices are allowed to be negative and are interpreted as indexing backwards, from the end of the string. Thus, the last character is at position -1, and so on.
The string library provides all its functions inside the table string. It also sets a metatable for strings where the __index field points to the string table. Therefore, you can use the string functions in object-oriented style. For instance, string.byte(s, i) can be written as s:byte(i).
The string library assumes one-byte character encodings
TO DO: test and add missing Luau String functions from https://create.roblox.com/docs/reference/engine/libraries/string, like pack, packsize, split, unpack, ...
Methodsstring.byte returns numerical code |
EventsConstants |