void OnStart()
{
//--- 定义源字符串(右侧六个空格)
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'
*/
}
|