string.TrimStart Method

Trims off characters or white space from the start of a String variable value.
...string.TrimStart( trim_chars )

Prerequisites

None

Parameters

trim_chars

An optional String expression.  The characters of this expression define the individual characters that are to be trimmed from the start of the string.  If a trimming character String is not specified, any white space (e.g. space and/or horizontal tab characters) is trimmed off.

Remarks

This method trims off any occurrence of the characters specified in the trim_chars expression from the associated string variable and returns the resulting String value.  If multiple trim characters are present in the string, trimming continues until a non-trim character is encountered.  Trimming is performed at the start of the string variable.

Examples

Dim stg_a, stg_t As String      ' Create string variables
stg_a = "112211this is a test221122"
stg_t = stg_a.Trim("12") ' stg_t set to "this is a test"
stg_t = stg_a.TrimStart("21") 'stg_t set to "this is a test221122"
stg_t = stg_a.TrimEnd("123") 'stg_t set to "112211this is a test"
stg_a = " another test "
stg_t = stg_a.Trim() ' stg_t set to "another test"

See Also

Strings |string.Trim|string.TrimEnd