我有一个字符串的问题。字符串是这样的:
string something = " whatever and something else ";
现在我试图摆脱开头和结尾的空格,如下所示:
something = something.Trim();
但这没有用,我也试过这个:
something = something.TrimStart();
something = something.TrimEnd();
还有这个:
something = something.TrimStart(' ');
something = something.TrimEnd(' ');
还有这个:
int lineLength = line.Length;
string LastCharacter = line.Remove(lineLength - 1);
while (LastCharacter == " ")
{
line = line.Remove(lineLength - 1);
lineLength = line.Length;
LastCharacter = line.Remove(lineLength - 1);
}
字符串不在 RichTextBox 中。
现在我认为这可能是文本格式或其他问题(我在德国)。
提前谢谢你, tietze111