string a = "中国,欢迎#你";
char[] c ={ ',', '#' };
string [] b=new string[100];
b = a.Split(c);
for (int i = 0; i<a.Length; i++)
{
Console.Write("item{0}:{1}",i,b[i]); }
Console.ReadLine();上面语句执行,提示索引超出了数组界限,请各位大哥帮忙指点。
char[] c ={ ',', '#' };
string [] b=new string[100];
b = a.Split(c);
for (int i = 0; i<a.Length; i++)
{
Console.Write("item{0}:{1}",i,b[i]); }
Console.ReadLine();上面语句执行,提示索引超出了数组界限,请各位大哥帮忙指点。
解决方案 »
- TransactionScope 锁表
- 大家多线程同步都是怎么做的
- C#中怎样编码获得系统图标
- 数据表的查询问题
- 如何遍历该泛型,类型为CLASS,我要获得Class中属性的值
- 关于DATAGRID控件中单元格中使用可选择控件的问题?急!!!
- 请问在c#控制台应用程序下怎么调用window api··我要设置和获取鼠标位置
- C# ComboBox DataSource刷新.
- 50分问一个关于序列化类的问题。只要答复就有分!
- 55 高手帮忙。两个界面之间传值
- 程序点击关闭退出后,发现进程过10多秒之后才完全退出?
- WinForm程序C#生成word报表,需求如下(做过报表和生成word模板过来看,有点难度,望高手解决)。
====================================
for (int i = 0; i<b.Length; i++)
=>
for (int i = 0; i < b.Length; i++)
char[] c ={ ',', '#' };
string [] b=new string[100];
b = a.Split(c);
for (int i = 0; i<a.Length; i++) a中含有,# 比b多2个长度 必然越界
{
Console.Write("item{0}:{1}",i,b[i]); }
Console.ReadLine();
char[] c ={ ',', '#' };
string [] b=new string[100];
b = a.Split(c);
for (int i = 0; i<b.Length; i++)
{
Console.Write("item{0}:{1}",i,b[i]); }
Console.ReadLine();
char[] c ={ ',', '#' };
string [] b=new string[100];
b = a.Split(c);
for (int i = 0; i<b.Length; i++)
{
Console.Write("item{0}:{1}",i,b[i]); }
Console.ReadLine();