string.TrimLeft
From GMod Wiki
| Function | |
| Syntax |
string.TrimLeft( String string [, String char] ) Where is this used? |
| Description: | |
| Removes beginning white spaces from a string. | |
| Returns: | String |
| Part of Library: | String |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=String.TrimLeft]String.TrimLeft [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
| Description | Trims the white space off the left side of the string. |
|---|---|
| Used on | |
| Code | print( string.TrimLeft(" Test ") ) |
| Output | "Test " |
Additional Notes
- Seems to not do what it should do.
Here is a quick fix:
string.TrimLeft = function(str, ...) str = string.reverse(str) str = string.TrimRight(str, ...) str = string.reverse(str) return str end
- If char is specified, the string gets that character trimmed off instead of a space.