字符串变量将值存储为... careteam order 4-26-11.csv
我需要在c#中修剪值..就像careteamorder4-26-11.csv
一样 - 删除空格..!
如何删除字符串变量中的空格?
答案 0 :(得分:44)
string trimmed = "careteam order4-26-11.csv".Replace(" ", string.Empty);
答案 1 :(得分:0)
public string RemoveSpaceAfter(string inputString)
{
try
{
string[] Split = inputString.Split(new Char[] { ' ' });
//SHOW RESULT
for (int i = 0; i < Split.Length; i++)
{
fateh += Convert.ToString(Split[i]);
}
return fateh;
}
catch (Exception gg)
{
return fateh;
}
}