我有看起来像这样的字符串,
"ad hominem ",
"ad lib ",
"ad lib ",
"adamantine ",
"adamite ",
"adder ",
"Addisonian ",
"addlepated ",
"adduce ",
所以基本上我想做的是在有多个空格字符(意思不是两个词)的情况下,摆脱它,所以欲望看起来像这样
"ad hominem",
"ad lib",
"ad lib",
"adamantine",
"adamite",
"adder",
"Addisonian",
"addlepated",
"adduce",
这是我尝试过的:
sb = (Regex.Replace(sb," ", ""));
sb = (Regex.Replace(sb," ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
sb = (Regex.Replace(sb, " ", ""));
*edit Trim() 不起作用,因为空格不在末尾或开头。