C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String Split()The C# Split() method is used to split a string into substrings on the basis of characters in an array. It returns string array. Signaturepublic string[] Split(params Char[] ch) public string[] Split(Char[], Int32) [ComVisibleAttribute(false)] public string[] Split(Char[], Int32, StringSplitOptions) [ComVisibleAttribute(false)] public string[] Split(Char[], StringSplitOptions) [ComVisibleAttribute(false)] public string[] Split(String[], Int32, StringSplitOptions) public string[] Split(String[], StringSplitOptions) Parameterch: it is a character type array. ReturnIt returns array of string C# String Split() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = "Hello C Sharp"; string[] s2 = s1.Split(' '); foreach (string s3 in s2) { Console.WriteLine(s3); } } } Output: Hello C Sharp
Next TopicC# String StartsWith()
|