string str = "1,2,3,4,5,6,7";
string[] strArray = str.Split(','); //字符串轉數組
str = string.Empty;
str = string.Join(",", strArray);//數組轉成字符串
C#判斷字符串是否存在某個字符,如果存在進行替換。
//定義一個字符串
string
str=
".net/Java/asp.net"
;
//檢驗“/”
if
(str.Contains(
"/"
))
{
//替換“/”為“||”
str
.Replace(
'/'
,
'||'
);
}
