splitSubstring
splitSubstring(text: String; startPos: Integer; len: Integer; splits: JadeRegexResult io): Integer;
The splitSubstring method of the JadeRegexPattern class splits the specified portion of the text into substrings using the Regex pattern as delimiters. The portion is defined by the specified start position and length (in characters).
The method returns the number of substrings that were created. The produced substrings are collated in a JadeRegexResult object.
You can use you can use the JadeRegexPattern class EndOfString constant instead of a length in len parameter.
The following is an example of a splitSubstring method that performs a split of a text string into substrings, starting at a specified position for a specified length.
splitSubstringExample(); constants SplitMaxStringLength = 16; Text = "this string will be split into words"; PatternStr = "\s"; vars compiledPattern : JadeRegexPattern; splits : JadeRegexResult; numOfSplits, i : Integer; begin create compiledPattern; compiledPattern.compile(PatternStr); numOfSplits := compiledPattern.splitSubstring(Text, 1, SplitMaxStringLength, splits); foreach i in 1 to numOfSplits do write i.String&") "&splits.at(i).value; endforeach; /* 1) this 2) string 3) will */ epilog delete compiledPattern; delete splits; end;
2020.0.01 and higher