Description |
Removes selected leading characters from the current string.
It starts at the beginning of the string and keeps removing characters when they match one of the CharArray characters. It continues through the string removing characters until it encounters a character not in the array.
|
| Notes | Like a lot of string methods, the string object itself is not affected - the modified string is returned for assignment.
|
|
Microsoft MSDN Links |
system
system.String
|
|
|
A simple example |
program Project1;
{$APPTYPE CONSOLE}
var
strA, strB : String;
charArray : Array[0..1] of Char;
begin
strA := ' --- Hello -- ';
charArray[0] := ' ';
charArray[1] := '-';
Console.WriteLine('strA = ''' + strA + '''');
strB := strA.TrimStart(charArray);
Console.WriteLine('Trimming '' '' and ''-'' chars from the start only');
Console.WriteLine('strB = ''' + strB + '''');
Console.ReadLine;
end.
| Show full unit code | strA = ' --- Hello -- '
Trimming ' ' and '-' chars from the start only
strB = 'Hello' -- '
|
|
|
|