If endSlice is omitted, slice extracts to the end of the string. Method of String object Description slice extracts the text from one string and returns a new string. Changes to the text in one string do not affect the other string. The following example uses slice to create a new string. It can take a limit count so that it won't include trailing empty elements in the resulting array.
Parameters string is any string.
When found, separator is removed from the string and the substrings are returned in an array. If separator is omitted, the array contains one element consisting of the entire string. If separator is a regular expression, any included parenthesis cause submatches to be included in the returned array. Using the optional limit argument, you can avoid including trailing empty elements in the returned array. Examples Example 1.