string.sub
From GMod Wiki
| Function | |
| Syntax |
string.sub( String Str, Integer Start[, Integer End] ) Where is this used? |
| Description: | |
| Returns a substring of the string passed. The third parameter is NOT the length, this is a common mistake - it is a position in the string like Start. | |
| Returns: | String |
| Part of Library: | String |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=String.sub]String.sub [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Additional Notes
- Strings start at 1, meaning string.sub("abc", 1, 1) will return "a", the first character of the string.
- Not supplying a value for 'End' will automatically assume the last position in the string!