Difference between revisions of "String.byte"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")  | 
				|||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__  | __NOTOC__  | ||
'''Available since:''' Gideros 2011.6<br/>  | '''Available since:''' Gideros 2011.6<br/>  | ||
| + | '''Class:''' [[string]]<br/>  | ||
| + | |||
=== Description ===  | === Description ===  | ||
| − | + | Returns the internal numerical codes of the characters s[i], s[i+1], ···, s[j].  | |
| + | <syntaxhighlight lang="lua">  | ||
| + | (numbers) = string.byte(s,i,j)  | ||
| + | </syntaxhighlight>  | ||
| + | |||
| + | The default value for i is 1; the default value for j is i.  | ||
| + | |||
| + | Returns nil if index out of range.  | ||
| + | |||
| + |  '''Numerical codes are not necessarily portable across platforms.'''  | ||
| − | |||
| − | |||
| − | |||
| − | |||
=== Parameters ===  | === Parameters ===  | ||
| − | '''s''': (string)   | + | '''s''': (string) string to get numerical codes from<br/>  | 
| − | '''i''': (number)   | + | '''i''': (number) start symbol (default = 1) '''optional'''<br/>  | 
| − | '''j''': (number)   | + | '''j''': (number) end symbol (defaults = i) '''optional'''<br/>  | 
| + | |||
=== Return values ===  | === Return values ===  | ||
| − | '''Returns''' (numbers)   | + | '''Returns''' (numbers) numerical codes of characters in provided range or nil<br/>  | 
| + | |||
| + | {{String}}  | ||
Latest revision as of 14:33, 13 July 2023
Available since: Gideros 2011.6
Class: string
Description
Returns the internal numerical codes of the characters s[i], s[i+1], ···, s[j].
(numbers) = string.byte(s,i,j)
The default value for i is 1; the default value for j is i.
Returns nil if index out of range.
Numerical codes are not necessarily portable across platforms.
Parameters
s: (string) string to get numerical codes from
i: (number) start symbol (default = 1) optional
j: (number) end symbol (defaults = i) optional
Return values
Returns (numbers) numerical codes of characters in provided range or nil