public static void Main()
    {
        RegexSplit rs = new RegexSplit();

        Console.WriteLine("Splitting 10 occurrences on a null string starting at 'a'");
        rs.Split14();

//       Console.WriteLine("Calling static Regex.Split(string, string, RegexOptions)");
//       rs.Split11();
//       Console.WriteLine("Calling static Regex.Split with capturing parentheses and RegexOptions:");
//       rs.Split12();
//       Console.WriteLine("Calling static Regex.Split with multiple capturing parentheses and RegexOptions:");
//       rs.Split13();
    }
Esempio n. 2
0
 /// <summary>
 /// Splits the specified input string a specified number of times at the positions defined by the regular expression into an enumerable collection of strings, using the specified split options.
 /// The search starts at a specified position in the input string.
 /// </summary>
 /// <param name="regex">The regular expression to be matched.</param>
 /// <param name="input">The string to split.</param>
 /// <param name="count">The maximum number of times the input can be split.</param>
 /// <param name="startAt">The position in the input string where the search starts.</param>
 /// <param name="splitOptions">A bitwise combination of the enumeration values that specify options.</param>
 /// <exception cref="ArgumentNullException"><paramref name="regex"/> or <paramref name="input"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.
 /// <para><paramref name="startAt"/> is less than zero or greater than the length of <paramref name="input"/>.</para>
 /// </exception>
 public static IEnumerable <string> EnumerateSplit(this Regex regex, string input, int count, int startAt, SplitOptions splitOptions)
 {
     return(RegexSplit.EnumerateValues(regex, input, count, startAt, splitOptions));
 }
Esempio n. 3
0
 /// <summary>
 /// Splits the specified input string a specified number of times at the positions defined by the regular expression into an enumerable collection of strings.
 /// </summary>
 /// <param name="regex">The regular expression to be matched.</param>
 /// <param name="input">The string to split.</param>
 /// <param name="count">The maximum number of times the input can be split.</param>
 /// <exception cref="ArgumentNullException"><paramref name="regex"/> or <paramref name="input"/> is <c>null</c>.</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="count"/> is less than zero.</exception>
 public static IEnumerable <string> EnumerateSplit(this Regex regex, string input, int count)
 {
     return(RegexSplit.EnumerateValues(regex, input, count));
 }