如何分割字符串 如何将字符串"BJB&Q0711-515BJ-P[___]80210517",按[___]分割成两个字符串BJB&Q0711-515BJ-P和80210517存放在数组里面 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.360doc.com/content/10/0930/11/2788266_57515420.shtml string str_arry = "BJB&Q0711-515BJ-P[___]80210517"; string str_a = str_arry.spilt('[___]'); string str="BJB&Q0711-515BJ-P[___]80210517";string []strs=str.split('[___]'); string str ="BJB&Q0711-515BJ-P[___]80210517";string strs = str.substring(0,17); //0 startstr 17 endstr string s ="BJB&Q0711-515BJ-P[___]80210517";string[] strary = s.split('[___]'); string str = "BJB&Q0711-515BJ-P[___]80210517"; string[] result = str.Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries); string str = "BJB&Q0711-515BJ-P[___]80210517"; string s1 = str.Substring(0, str.IndexOf('[')); string s2 = str.Substring(str.IndexOf(']') + 1, str.Length - str.IndexOf(']') - 1); string[] sl = new string[] { s1, s2 }; MessageBox.Show(s1 + " " + s2 + "\n" + sl[0] + " " + sl[1]); 是 “s1” 和 “sl” 别搞混~ 可以 string[] sList = new string[] { s1, s2 }; StringSplitOptions命名空间是什么,我在.net1.1下编译不通过。 1.1不清楚 2.0以上的 System 来一个正则表达式的 String input = @"BJB&Q0711-515BJ-P[___]80210517"; String pattern = @"\.*\[___]\.*";//要匹配字符前后都设置的任意位数的任意字符,可以根据自己需求设置pattern Regex regex = new Regex(pattern); Response.Write(regex.IsMatch(input)); TextBox1.Text = regex.Split(input)[0]; TextBox2.Text = regex.Split(input)[1]; string st = "BJB&Q0711-515BJ-P[_]80210517"; char[] a = { '[', '_', ']' }; string []aa = st.Split(a); string test="";foreach(string sin test.Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries)){} string s = "BJB&Q0711-515BJ-P[___]80210517";string[] fields = Regex.Split(s, Regex.Escape("[___]"));//fields 就是你要的结果。 string[] s_temp="BJB&Q0711-515BJ-P[___]80210517".spilt("[___]"); C# codestring str = "BJB&Q0711-515BJ-P[___]80210517";string[] result = str.Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries); string str_arry = "BJB&Q0711-515BJ-P[___]80210517"; string str_a = str_arry.spilt('[___]'); 编译都通不过还简单?string[] s_temp = "BJB&Q0711-515BJ-P[___]80210517".Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries);这样才行 有没有人用过Datawindow .net 的,求指点 如何获取html中特定字符串中的值? The dialect was not set. Set the property hibernate.dialect. gif图片中插入声音 求一个算法?请多帮忙。。 【求助算法和方案】我要生成5000个唯一的随机字符串(数字、字母),如何做? 下面的语句哪种效率高 双引号求助 我想做一个类似Acrobat Reader的启动界面,怎么做啊? 怎样用代码设置控件的tooptip属性? dataGridView 同步更新问题! (求教)关于如何更改键盘实际发送值的问题
string str_arry = "BJB&Q0711-515BJ-P[___]80210517";
string str_a = str_arry.spilt('[___]');
string []strs=str.split('[___]');
string str ="BJB&Q0711-515BJ-P[___]80210517";
string strs = str.substring(0,17); //0 startstr 17 endstr
string[] strary = s.split('[___]');
string[] result = str.Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries);
string str = "BJB&Q0711-515BJ-P[___]80210517";
string s1 = str.Substring(0, str.IndexOf('['));
string s2 = str.Substring(str.IndexOf(']') + 1, str.Length - str.IndexOf(']') - 1);
string[] sl = new string[] { s1, s2 }; MessageBox.Show(s1 + " " + s2 + "\n" + sl[0] + " " + sl[1]);
是 “s1” 和 “sl” 别搞混~ 可以 string[] sList = new string[] { s1, s2 };
1.1不清楚 2.0以上的 System
Regex regex = new Regex(pattern);
Response.Write(regex.IsMatch(input)); TextBox1.Text = regex.Split(input)[0];
TextBox2.Text = regex.Split(input)[1];
char[] a = { '[', '_', ']' };
string []aa = st.Split(a);
foreach(string sin test.Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries)){}
string s = "BJB&Q0711-515BJ-P[___]80210517";
string[] fields = Regex.Split(s, Regex.Escape("[___]"));
//fields 就是你要的结果。
string str = "BJB&Q0711-515BJ-P[___]80210517";
string[] result = str.Split(new string[] { "[___]" }, StringSplitOptions.RemoveEmptyEntries);
string str_a = str_arry.spilt('[___]');
这样才行