Difference between revisions of "String"
Line 2: | Line 2: | ||
'''Supported platforms:''' android, ios, mac, pc<br/> | '''Supported platforms:''' android, ios, mac, pc<br/> | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
− | === Description === | + | === <translate>Description</translate> === |
<translate>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. | <translate>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. | ||
Line 10: | Line 10: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Methods === | + | === <translate>Methods</translate> === |
[[Special:MyLanguage/string.byte|string.byte]] ''<translate>returns numerical code, nil if index out of range, default i=1</translate>''<br/> | [[Special:MyLanguage/string.byte|string.byte]] ''<translate>returns numerical code, nil if index out of range, default i=1</translate>''<br/> | ||
[[Special:MyLanguage/string.char|string.char]] ''<translate>returns a string built from 0 or more integers</translate>''<br/> | [[Special:MyLanguage/string.char|string.char]] ''<translate>returns a string built from 0 or more integers</translate>''<br/> | ||
Line 25: | Line 25: | ||
[[Special:MyLanguage/string.upper|string.upper]] ''<translate>returns string with letters in upper case</translate>''<br/> | [[Special:MyLanguage/string.upper|string.upper]] ''<translate>returns string with letters in upper case</translate>''<br/> | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === Events === | + | === <translate>Events</translate> === |
− | === Constants === | + | === <translate>Constants</translate> === |
|} | |} |
Revision as of 07:30, 24 August 2018
Supported platforms: android, ios, mac, pc
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.
Methodsstring.byte returns numerical code, nil if index out of range, default i=1 |
EventsConstants |