ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

Split

Split by expression

Source

public static string[] Split(this string value, string regexPattern)
{
    return value.Split(regexPattern, RegexOptions.None);
}

public static string[] Split(this string value, string regexPattern, 
    RegexOptions options)
{
    return Regex.Split(value, regexPattern, options);
}

Example

var obj = "abc,def,ghi";
string[] arrays = obj.Split(",");

Author: David Seff

Submitted on: 25 aug. 2016

Language: C#

Type: string[]

Views: 4803