Difference between revisions of "String.sub"
From OpenEUO
(Created page with " string.sub (s, i [, j]) Returns the substring of s that starts at i and continues until j; i and j can be negative. If j is absent, then it is assumed to be equal to -1 (which i...") |
|||
Line 1: | Line 1: | ||
string.sub (s, i [, j]) | string.sub (s, i [, j]) | ||
Returns the substring of s that starts at i and continues until j; i and j can be negative. If j is absent, then it is assumed to be equal to -1 (which is the same as the string length). In particular, the call string.sub(s,1,j) returns a prefix of s with length j, and string.sub(s, -i) returns a suffix of s with length i. | Returns the substring of s that starts at i and continues until j; i and j can be negative. If j is absent, then it is assumed to be equal to -1 (which is the same as the string length). In particular, the call string.sub(s,1,j) returns a prefix of s with length j, and string.sub(s, -i) returns a suffix of s with length i. | ||
+ | |||
+ | [[String.find]] | ||
+ | |||
+ | [[String.gmatch]] | ||
+ | |||
+ | [[String.len]] | ||
+ | |||
+ | [[String.match]] | ||
+ | |||
+ | [http://www.lua.org/manual/5.1/manual.html#2.5.5 Lua Manual - The length operator #] |
Latest revision as of 12:59, 9 October 2010
string.sub (s, i [, j])
Returns the substring of s that starts at i and continues until j; i and j can be negative. If j is absent, then it is assumed to be equal to -1 (which is the same as the string length). In particular, the call string.sub(s,1,j) returns a prefix of s with length j, and string.sub(s, -i) returns a suffix of s with length i.