Skip to main content

Posts

Showing posts with the label Split Method of String Class in C#

Split Method of String Class in C# Explained

Split Method of String Class in C# In C#, Split() is a  string class  method. The Split() method returns an array of strings generated by splitting of original string separated by the delimiters passed as a parameter in Split() method. The delimiters can be a character or an array of characters or an array of strings. Or you can also say that it returns a string array which contains the substrings in the current instance that are delimited by elements of a specified string or Unicode character array. Split Method Syntax The following is the syntax of defining a split  method  in C#.   //split syntax in C#   public string [] Split( char [] separator)   From the above syntax, we are using a character array ( char[] ) as argument to define delimiters to split the given string into  substrings  and return it as a string  array .   Example of Split Method in C# The code snippets below is the example of splitting t...