关于字符串比较的 简单问题,在线送分!!! indexof判断的时候找"5,"以及最后一个字符是否为",5"。只有这两种情况才算包含。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 意思可能理解错了,我是说 b 也许会是 string b="1,2,3,4,6565,6,7";这样 用 b.indexof 不行哦。。 我就是想用 字符串数组 来做,,代码如何,因为 a b 都是 ID 字段,我想看是否包含 什莫意思?那你用split把b按照“,”拆分成数组,再和a比较吧! string [] astr = b.split(",")if( a in astr )//伪码 char ch = ',';String [] myArray = b.Split(ch);int nPos = myArray.IndexOf(a) Array myArray=Array.CreateInstance( typeof(String), 12 ); myArray.SetValue( "the", 0 ); myArray.SetValue( "quick", 1 ); myArray.SetValue( "brown", 2 ); myArray.SetValue( "fox", 3 ); myArray.SetValue( "jumps", 4 ); myArray.SetValue( "over", 5 ); myArray.SetValue( "the", 6 ); myArray.SetValue( "lazy", 7 ); myArray.SetValue( "dog", 8 ); myArray.SetValue( "in", 9 ); myArray.SetValue( "the", 10 ); myArray.SetValue( "barn", 11 ); // Searches for the first occurrence of the duplicated value. String myString = "the"; int myIndex = Array.IndexOf( myArray, myString ); string ChildIdItems=mytree2.GetCheckItems(mytreeview.Nodes,id.Text);//当前编辑节点ID的所有子ID,包括自己ID Response.Write(ChildIdItems+"<br>"); // Response.Write(ChildIdItems.array(CurrentId); string[] MyChildIdItems=ChildIdItems.Split(","); Response.Write(MyChildIdItems); if (CurrentId in MyChildIdItems ) {if (CurrentId in MyChildIdItems ) 这句有问题吗???? char ch = ',';String [] myArray = b.Split(ch);int nPos = myArray.IndexOf(a)系统说 myArray 都没有 IndexOf 方法,,,晕了。 string a="5";string c="545";string b="1,2,3,4,545,6,7";其实我的意思很简单,只要判断出 b 包含 c , b 不包含 a 就可以了,也就是 把 545 当成一个整体元素来看待,不算太复杂把,,但是char ch = ',';String [] myArray = b.Split(ch);int nPos = myArray.IndexOf(a)居然不行说没有 IndexOf 方法??????????????????????????????????????????好晕啊。。 布局的一个问题…… 母板页问题 急急急!!vs2005 datakeyname怎么赋值!! Asp.Net问题!急!!! ASP.NET做论坛 年前最后一问,来者有分!我用存储过程分页,我无法得到返回值,帮我看看怎么了? 一个关于datagrid的问题 TreeView控件能否让它没有默认的选中状态,就是一个节点也不让选中,点击才行! 怎么转成字符串? 三角穿满了,和大家分享一下,顺便说说有时候打开帖子碰到的问题的解决方法。 简单问题:ASP.net页面的验证器失效,这是怎么回事?呵呵,第一个解决问题的人占光了.全分奉送. 请高手帮忙
这样 用 b.indexof 不行哦。。
if( a in astr )
//伪码
String [] myArray = b.Split(ch);
int nPos = myArray.IndexOf(a)
myArray.SetValue( "the", 0 );
myArray.SetValue( "quick", 1 );
myArray.SetValue( "brown", 2 );
myArray.SetValue( "fox", 3 );
myArray.SetValue( "jumps", 4 );
myArray.SetValue( "over", 5 );
myArray.SetValue( "the", 6 );
myArray.SetValue( "lazy", 7 );
myArray.SetValue( "dog", 8 );
myArray.SetValue( "in", 9 );
myArray.SetValue( "the", 10 );
myArray.SetValue( "barn", 11 ); // Searches for the first occurrence of the duplicated value.
String myString = "the";
int myIndex = Array.IndexOf( myArray, myString );
Response.Write(ChildIdItems+"<br>");
// Response.Write(ChildIdItems.array(CurrentId);
string[] MyChildIdItems=ChildIdItems.Split(","); Response.Write(MyChildIdItems); if (CurrentId in MyChildIdItems )
{if (CurrentId in MyChildIdItems ) 这句有问题吗????
String [] myArray = b.Split(ch);
int nPos = myArray.IndexOf(a)
系统说 myArray 都没有 IndexOf 方法,,,晕了。
string c="545";string b="1,2,3,4,545,6,7";其实我的意思很简单,只要判断出 b 包含 c , b 不包含 a
就可以了,也就是 把 545 当成一个整体元素来看待,不算太复杂把,,但是char ch = ',';
String [] myArray = b.Split(ch);
int nPos = myArray.IndexOf(a)居然不行说没有 IndexOf 方法??????????????????????????????????????????好晕啊。。