当前位置: > System.Text.StringBuilder”并不包含“Split”的定义...
题目
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 < str1.Length)
{
Console.WriteLine("{0}:{1}",j,str1[j]);
j++;
}
Console.Read();
}
}
}

提问时间:2021-01-10

答案
str1 = newstr.Split(tor); 这行 换成
str1 = newstr.ToString().Split(tor);
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.