TypeScript | String split() Method
The split() is an inbuilt function in TypeScript which is used to splits a String object into an array of strings by separating the string into sub-strings.
Parameter: This method accepts two parameter as mentioned above and described below:
- separator – This parameter is the the character to use for separating the string.
- limit – This parameter is the Integer specifying a limit on the number of splits to be found.
Return Value: This method returns the new array.
Below examples illustrate the String split() method in TypeScript.
[ 'Geeksforgeeks', '-', 'Best', 'Platform' ]
[ 'G', 'e', 'e', 'k', 's', 'f', 'o', 'r', 'g', 'e', 'e', 'k', 's', ' ' ]