BBjString::regionMatches
Description
In BBj 7.0 and higher, this method tests if two string regions are equal.
A substring of this String object is compared to a substring of the argument other. The result is true if these substrings represent identical character sequences. The substring of this String object to be compared begins at index toffset and has length len. The substring of other to be compared begins at index ooffset and has length len. The result is false if and only if at least one of the following is true:
- toffset is negative.
- ooffset is negative.
- toffset+len is greater than the length of this String object.
- ooffset+len is greater than the length of the other argument.
- ignoreCase
is false and there is some nonnegative integer k less than len such
that:
this.charAt(toffset+k) != other.charAt(ooffset+k)
-
ignoreCase is true and there is some nonnegative integer k less than len such that:
Character.toLowerCase(this.charAt(toffset+k)) !=
Character.toLowerCase(other.charAt(ooffset+k))
and:Character.toUpperCase(this.charAt(toffset+k)) !=
Character.toUpperCase(other.charAt(ooffset+k))
Syntax
Return Value |
Method |
---|---|
boolean |
regionMatches(boolean ignoreCase, int toffset, string other, int ooffset, int len) |
boolean |
regionMatches(int toffset, string other, int ooffset, int len) |
Parameters
Variable |
Description |
---|---|
ignoreCase |
If true, ignore case when comparing characters. |
toffset |
The starting offset of the subregion in this string. |
other |
The string argument. |
ooffset |
The starting offset of the subregion in the string argument. |
len |
The number of characters to compare. |
Return Value
Returns true if the specified subregion of this string matches the specified subregion of the string argument; false otherwise. Whether the matching is exact or case insensitive depends on the ignoreCase argument.
Remarks
None.
Example
|
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.