我有这样的字符串:
string stuff = " this is something you could use one day";
我正在使用以下功能来删除额外的空格:
private string removeThem(string str) {
if (str!= null){
return Regex.Replace(str, @"\s+", " ");
}else{
return "";
}
}
所以在应用该功能后,我得到:
" this is something you could use one day"
但我想要:
"this is something you could use one day"
怎么做?