Link Search Menu Expand Document

RegexPattern.Split Method

Explanation Gets a String array split based on the match between the regular expression pattern and the input string
The following is an example of splitting "a--/ cde / f--".
Regular expressions limit result
/ / 2 "a--", "cde / f--"
/ / Ten "a--", "cde", "f--"
/ / -1 "a--", "cde", "f--"
―――― Five "a", "", "/ cde / f", "", ""
―――― -2 "a", "", "/ cde / f", "", ""
―――― 0 "a", "", "/ cde / f"
Call format var arr = rp.Split( input [, limit ] )
Return value An array of String objects that split the input based on the match
The last element of the array contains the string after the last matched position.
Since Ver.5.0.1, UString type array is returned in Unicode mode.
Arguments String input Matching input string
Since Ver.5.0.1, it is treated as UString type in Unicode mode
integer limit Maximum number of divisions
If greater than 0 , the returned array length will be less than or equal to limit
Negative values ​​do not limit the length of the array.
If 0 , the length of the array is not limited, but the following empty string is discarded. If omitted, it will be 0.
Exception None
Example of use
var p = RegexPattern.Compile("/");
var arr = p.Split("Biz/Browser");
for (var i = 0; i < arr.length; i++) {
    print(arr[i], "\n");
}
    
Related item