char oldChar,
char newChar
)
string oldValue,string newValue
)
GameObject go=Instantiate (GameObject.Find("Cube"))as GameObject;
string name = go.name;
go.name = name.Replace ("(Clone)","");
int startIndex
)
int startIndex,int length
)
如果要去除返回的空字符串,可以用System.StringSplitOptions.RemoveEmptyEntries参数
以下并不可信——————————————————
我在应用中用到一些关于转义字符的时候,给大家总结一下,仅供大家参考:
1、如果用“.”作为分隔的话,必须是如下写法:String.split("\\."),这样才能正确的分隔开,不能用String.split(".");
2、如果用“|”作为分隔的话,必须是如下写法:String.split("\\|"),这样才能正确的分隔开,不能用String.split("|");
“.”和“|”都是转义字符,必须得加"\\";
3、如果在一个字符串中有多个分隔符,可以用“|”作为连字符,比如:“acount=? and uu =? or n=?”,把三个都分隔出来,可以用String.split("and|or");
像下面这种写话就蛮周全了:
if(s.lastIndexOf("\\") >= 0)
{
s1 = s.substring(0, s.lastIndexOf("\\"));
s2 = s.substring(s.lastIndexOf("\\") + 1);
}
if(s.lastIndexOf("/") >= 0)
{
s1 = s.substring(0, s.lastIndexOf("/"));
s2 = s.substring(s.lastIndexOf("/") + 1);
}
还有一个注意就是indexOf和substring 混用的时候注意索引的位置
在判断文件类型的时候
f_type = f_name.Substring(f_name.LastIndexOf(".") + 1)