Posts

Showing posts with the label String Split

Different ways to use String Split Function in .NET

This method finds all the substrings in a string that are seperated by one or more characters, returning a string array. Split function has more number of overload method where you can specifiy the maximum number of elements in an array to return from the string. Here i have two important things about Split function of String class. Split function of the string class split the string in array of string. Split function to split string in array String.Split( char[]) string words = "apple,bat,cat,dog,,fox,Ghost." ; string [] split = words. Split ( new Char [] { ' ' , ',' }); O utput will be like this apple bat cat dog fox Ghost If you want to remove the Empty String Please make use of the Overloaded Methods. Overload method with option 1. String.Split(Char[], StringSplitOptions) string words = "apple,bat,cat,dog,,fox,Ghost."; string [] split = words. Split ( new Char [] { ' ' , ',...