字符串数组是否包含某个字符

 string[] elements = new string[50];
 if (Array.IndexOf<string>(elements, "a" ) != -1 )
 {
  //存在
  //返回的值就是 "a" 在数组中的下标
 }
 else
{
//不存在
}
posted @ 2016-12-09 16:15  AlexLeeLi  阅读(665)  评论(0编辑  收藏  举报