C#字符串中提取子字符串的问题? 比如我有一个拼凑起的字符串“hello&byebye”现在我要分别提取hello 和 byebye字符串用什么函数实现?因为用substring好像不行,因为hello是不固定长的字符c#没有java中的StringTokenizer类似的类吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string s="hello&byebye";string[] sArray=s.Split('&');foreach(string i in sArray)Console.WriteLine(i.ToString()); 楼上正解,如果分隔符不一样,可以改s.Split('&');中的参数 我自己也写了一个不知行否?string temp= “hello&byebye”;int index = temp.IndexOf("&"); string fisrt=temp.Substring(0,index);string second=temp.Substring(index);System.Console.WriteLine("{0}+++{1}",fisrt,second); C# list 转json 格式问题 设置文本控件是否可用引发的问题。 修改小键盘 NHibernate one2many 为什么会取到几个空对象? C#的程序用什么加壳呀? 求助!!如何把datagridview 内的数据 推送到 report 怎么让AssemblyInfo.cs中的内容显示出来 怎么判断打印完毕 能否将一个hashtable序列化得到一个networkstream? 请教,在线等待 在TreeView中,如何让某一节点在没有子节点的情况下,也显示左边的+号 03,05,能不能混用
Console.WriteLine(i.ToString());
string temp= “hello&byebye”;
int index = temp.IndexOf("&");
string fisrt=temp.Substring(0,index);
string second=temp.Substring(index);
System.Console.WriteLine("{0}+++{1}",fisrt,second);