string inputStr=" xx xx "; inputStr=Regex.Replace(inputStr.Trim()," *"," ");

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 18:24:57
string inputStr=
x)+.)KW+(- .)UR!%kXPjzj^PjANbrLX/(3WCSGIAK H(iZ$S@;';BMlg3?,{cާ|^6SV_]dGÓ -Y" @Zt52?k WTt60ע;bV z6yvPz'

string inputStr=" xx xx "; inputStr=Regex.Replace(inputStr.Trim()," *"," ");
string inputStr=" xx xx "; inputStr=Regex.Replace(inputStr.Trim()," *"," ");

string inputStr=" xx xx "; inputStr=Regex.Replace(inputStr.Trim()," *"," ");
Replace(inputStr.Trim()," *"," ")中Trim()方法是去掉字符串前后空白," *"," "是用后面一个空格" "替换掉前面的"*".,总的意思是用空格替换掉"*"并去掉inputStr字符串前后的空白.