void OnStart()
{
//--- 右側に6つのスペースを含むソース文字列を定義する
string text="All spaces on the right will be removed from this string ";
//--- ソース文字列をログで表示する
PrintFormat("Source line:\n'%s'", text);
//--- 右側のスペースをすべて削除し、削除された文字数と結果の文字列をログに表示する
int num=StringTrimRight(text);
PrintFormat("The StringTrimRight() function removed %d chars from the right side. Now the line looks like this:\n'%s'", num, text);
/*
結果
Source line:
'All spaces on the right will be removed from this string '
The StringTrimRight() function removed 6 chars from the right side. Now the line looks like this:
'All spaces on the right will be removed from this string'
*/
}
|