string.TrimLeft

From GMod Wiki

Revision as of 14:41, 2 October 2011 by C0BRA (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=String.TrimLeft]String.TrimLeft [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionTrims the white space off the left side of the string.
Used onNewerShared.png
Code
print( string.TrimLeft("          Test         ") )
Output"Test          "


Additional Notes

Here is a quick fix:

string.TrimLeft = function(str, ...)
	str = string.reverse(str)
	str = string.TrimRight(str, ...)
	str = string.reverse(str)
	return str
end

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox