Himall商城普通帮助类(二)
#region 數(shù)組操作
/// <summary>
/// 獲得字符串在字符串?dāng)?shù)組中的位置
/// </summary>
public static int GetIndexInArray(string s, string[] array, bool ignoreCase)
{
if (string.IsNullOrEmpty(s) || array == null || array.Length == 0)
return -1;
int index = 0;
string temp = null;
if (ignoreCase)
s = s.ToLower();
foreach (string item in array)
{
if (ignoreCase)
temp = item.ToLower();
else
temp = item;
if (s == temp)
return index;
else
index++;
}
return -1;
}
總結(jié)
以上是生活随笔為你收集整理的Himall商城普通帮助类(二)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【ujson】pip安装ujson报错:
- 下一篇: 大数据开发初学者学习路线