System.Text.StringBuilder”并不包含“Split”的定义想要以‘c’为分隔,分离字符串,但是提示如题错误,怎么改呢?using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication5{class Program{static void Main(string[] args){int i;Console.WriteLine("请输入一个字符串:");string str = Console.ReadLine();StringBuilder newstr = new StringBuilder(str);newstr.Insert(3,"abcd");Console.WriteLine(newstr);char[] tor ={ 'c' };string[] str1 = new string[100];str1 = newstr.Split(tor);int

问题描述:

System.Text.StringBuilder”并不包含“Split”的定义
想要以‘c’为分隔,分离字符串,但是提示如题错误,怎么改呢?
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
int i;
Console.WriteLine("请输入一个字符串:");
string str = Console.ReadLine();
StringBuilder newstr = new StringBuilder(str);
newstr.Insert(3,"abcd");
Console.WriteLine(newstr);
char[] tor ={ 'c' };
string[] str1 = new string[100];
str1 = newstr.Split(tor);
int j = 0;
while (j {
Console.WriteLine("{0}:{1}",j,str1[j]);
j++;
}
Console.Read();
}
}
}

str1 = newstr.Split(tor); 这行 换成
str1 = newstr.ToString().Split(tor);