• 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; } }
  • 相关阅读:
    洛谷 P4708
    NFLSOJ 1060
    Codeforces 1264D
    Solution -「多校联训」Sample
    Solution -「多校联训」光影交错
    Solution -「LOJ #138」「模板」类欧几里得算法
    Solution -「LOJ #141」回文子串 ||「模板」双向 PAM
    Codeforces Round #700 (Div. 2)
    Codeforces Round #698 (Div. 2) C and D
    「NOI 2021」题解
  • 原文地址:https://www.cnblogs.com/bianlan/p/3075186.html
Copyright © 2020-2023  润新知