Garry's Mod Wiki

string.Trim

  string string.Trim( string Inputstring, string Char = "%s" )

Description

Removes leading and trailing matches of a string.

Arguments

1 string Inputstring
The string to trim.
2 string Char = "%s"
String to match - can be multiple characters. Matches spaces by default.

Returns

1 string
Modified string

Example

Demonstrates the use of string. Trim without second argument.

MsgN(string.Trim(" hi whatsup "))
Output: "hi whatsup"

Example

Trim with longer strings as second argument.

MsgN(string.Trim("you cant be serious ,you", "you"))
Output: " cant be serious ,"