hello

String.Split


public
static class StringHelper { /// <summary> /// convert string to list by separators /// </summary> /// <param name="str">the string you want to deal with</param> /// <param name="separators">the separator char array </param> /// <returns></returns> public static List<string> StringToListBySeparators(this string str, char[] separators) { string[] strs = str.Split(separators); List<string> liststr = new List<string>(strs); return liststr; } /// <summary> /// convert string to list by separators /// </summary> /// <param name="str">the string you want to deal with</param> /// <param name="separators">the separator string </param> /// <returns></returns> public static List<string> StringToListBySeparators(this string str, string separators) { string[] strs = Regex.Split(str, separators, RegexOptions.IgnoreCase); List<string> liststr = new List<string>(strs); return liststr; } /// <summary> /// convert string to list by separators /// </summary> /// <param name="str">the string you want to deal with</param> /// <param name="separators">the separator char </param> /// <returns></returns> public static List<string> StringToListBySeparators(this string str, char separators) { string[] strs = str.Split(separators); List<string> liststr = new List<string>(strs); return liststr; } }

 

posted @ 2013-05-13 10:10  B追风少年  阅读(304)  评论(0编辑  收藏  举报

hello too