Removing char in string from specific index

前端 未结 5 913
情话喂你
情话喂你 2021-02-18 14:25

Is there any function in C# that remove from string on specific index, for example

string s = \"This is string\";

s.RemoveAt(2);

s is now \"Th

5条回答
  •  太阳男子
    2021-02-18 14:27

    string s = "This is string";
    s = s.Remove(2, 1);
    

    Output : Ths is string

    1st parameter is the starting index from which you want to remove character and 2nd parameter is the number of character you want to remove

提交回复
热议问题