在C#中查找IndexOf

3 c#

我如何找到indexof():

string value = "     50     ";  
Run Code Online (Sandbox Code Playgroud)

有空格......但我不想使用SubString()或删除它们Replace()......

我必须删除leftindex空格,直到我得到"5"并删除rightindex后的空格"0".

Rog*_*mbe 9

String.Trim


Gan*_*ant 5

只需使用value = value.Trim();,"50"之前和之后的所有空格都将消失.