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'
*/
}
|