Difference between revisions of "String.sub"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Available since:''' Gideros 2011.6<br/>
+
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
=== Description ===
+
=== <translate>Description</translate> ===
 
<translate>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.</translate>
 
<translate>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.</translate>
 
<source lang="lua">
 
<source lang="lua">
 
(string) = string.sub(s,i,j)
 
(string) = string.sub(s,i,j)
 
</source>
 
</source>
=== Parameters ===
+
=== <translate>Parameters</translate> ===
 
'''s''': (string) <translate>string to get substring from</translate> <br/>
 
'''s''': (string) <translate>string to get substring from</translate> <br/>
 
'''i''': (number) <translate>start index of substring</translate> <br/>
 
'''i''': (number) <translate>start index of substring</translate> <br/>
 
'''j''': (number) <translate>index of the last character of substring</translate> '''optional'''<br/>
 
'''j''': (number) <translate>index of the last character of substring</translate> '''optional'''<br/>
=== Return values ===
+
=== <translate>Return values</translate> ===
'''Returns''' (string) <translate>substring</translate><br/>
+
'''<translate>Returns</translate>''' (string) <translate>substring</translate><br/>

Revision as of 07:28, 24 August 2018

Available since: Gideros 2011.6

Description

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) = string.sub(s,i,j)

Parameters

s: (string) string to get substring from
i: (number) start index of substring
j: (number) index of the last character of substring optional

Return values

Returns (string) substring