Substring a string from the end of the string

前端 未结 9 1024
别跟我提以往
别跟我提以往 2020-12-16 11:16

I need to remove two characters from the end of the string.

So:

string = \"Hello Marco !\"

must be

Hello Marco
         


        
9条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 11:47

    What about

    string s = "Hello Marco !";
    s = s.Substring(0, s.Length - 2);
    

提交回复
热议问题