string s="淘宝梦琪动漫屋";
s = s.Replace("淘宝","");
意思把淘宝两个字替换成空,相当于去掉了
1、String.Replace:
str = str.Replace("\r", string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty);
2、String.Aggregate:
string[] split = str.Split(new char[] { '\t', '\r', '\n' }, StringSplitOptions.None);
str = split.Aggregate
3、Regex.Replace:
str = Regex.Replace(str, "[\r\n\t]", string.Empty, RegexOptions.Compiled);
4、Char Array:
string s = "abc";
int len = s.Length;
char[] s2 = new char[len];
int i2 = 0;
for (int i = 0; i < len; i++)
{
char c = s[i];
if (c != '\r' && c != '\n' && c != '\t')
s2[i2++] = c;
}
return new String(s2, 0, i2);
5、String.Concat:
String.Concat(str.Split(new char[] { '\t', '\r', '\n' },
StringSplitOptions.None));