StringTrimLeft
Удаляет символы перевода каретки, пробелы и символы табуляции с начала строки до первого значимого символа. Строка модифицируется по месту.
int StringTrimLeft(
string& string_var
);
|
Параметры
string_var
[in][out] Строка, которая должна быть обрезана слева.
Возвращаемое значение
Пример:
void OnStart()
{
//--- определяем исходную строку с шестью пробелами слева
string text=" All spaces on the left will be removed from this string";
//--- Выводим исходную строку в журнал
PrintFormat("Source line:\n'%s'", text);
//--- удаляем слева все пробелы и выводим количество удалённых символов и полученную строку в журнал
int num=StringTrimLeft(text);
PrintFormat("The StringTrimLeft() function removed %d chars from the left side. Now the line looks like this:\n'%s'", num, text);
/*
Результат
Source line:
' All spaces on the left will be removed from this string'
The StringTrimLeft() function removed 6 chars from the left side. Now the line looks like this:
'All spaces on the left will be removed from this string'
*/
}
|
Смотри также
StringTrimRight, StringToLower, StringToUpper