题目
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();
}
}
}
想要以‘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);
str1 = newstr.ToString().Split(tor);
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 1为什么是live on space station而不是live in space station.live on靠~生活 代进去不通
- 220到口算题
- 30的无穷次方类求极限问题!
- 4环境因素对动物的行为产生多种影响,如环境因素中的非生物因素:()()()()等对动物的行为都能产生影
- 5小学三年级数学题在238除以6的笔算中,2个百除以6,商不够1个百,要把2个百看做()个(),在加上()来
- 6卫星在离月球较远的圆轨道上运行时,与月球距离为h1,离较近的距离为h2,月球半径为r,求卫星在距离h1,h2轨道上运行的动能之比
- 7已知甲数与乙数的和是23,甲数比乙数的3倍小5,求甲乙两数.设甲数是x,乙数是y,方程组为?
- 8已知直线y=3x与y=- x+4,求:⑴这两条直线的交点.⑵这两条直线与y轴围成的三角形面积.
- 9中学,大学的英语单词,翻译这三个词
- 10How long is your arm?怎么回答.
热门考点
- 1一个棱长3dm的正方体空玻璃缸里,先放入一个梨,再向里面倒水,当倒入8.5L水时,刚好把梨淹没,这时水深10厘米
- 2火车进站前,出站时速度为什么要减慢?
- 3化简 -2√10×3√30,√5又16分之1,√8+√18,3√6,3√2-√15,√5+√6,5√2-2√3 跪求!
- 4已知m的二次方+m-1=0,求m的三次方+2m的二次方+2007的值
- 5集体名词的用法
- 61999年4月15是周四,8月9是周几?
- 7两米的书架,30厘米一格,可以分成几格,还余多少米?
- 8在硫酸锌溶液中混有少量CuSO4溶液,可加入( )充分反应后( ),既能除去杂质,反应的方程式为( )
- 9位移的方向就是物体运动的方向吗?
- 10a的x次方=2,a的y次方=3,求a的2x+y次方和a的x+3y次方的值