发布网友
发布时间:2024-02-13 23:37
共3个回答
热心网友
时间:2024-02-29 00:42
如下。
string str = "12345";
int index2 = str.IndexOf("2"); //求出字符串str里元素“2”的位置所在索引号,
str = str.Insert(index2," "); //在字符串该索引号的位置添加空格。
Console.WriteLine(str);
结果如图,就有空格了。
热心网友
时间:2024-02-29 00:48
热心网友
时间:2024-02-29 00:45