StringTrimLeft
이 함수는 문자열 왼쪽 부분의 줄바꿈 문자, 공백 및 탭을 첫 번째 의미 있는 기호까지 잘라냅니다. 여기서 문자열이 수정됩니다.
int StringTrimLeft(
string& string_var
);
|
매개 변수
string_var
[in][out] 왼쪽에서 잘라낼 문자열.
반환값
예:
void OnStart()
{
//--- 왼쪽에 6개의 공백을 사용하여 소스 문자열을 정의합니다.
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