Java Tutorial : Java String [regionMatches(int toffset, String other, int ooffset, int len) method]
RegionMatchesDemo.java
/* * public boolean regionMatches(int toffset, * String other, * int ooffset, * int len) * * Parameters: * ---------- * 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. * * Returns: * ------- * true if the specified subregion of this string * exactly matches the specified subregion of the * string argument; false otherwise. */
public class RegionMatchesDemo { public static void main(String[] args) {
"Welcome to ramj2ee.com".regionMatches(11,"ramj2ee",0,7) =true "Welcome to ramj2ee.com".regionMatches(11,"RAMJ2EE",0,7) =false "Welcome to ramj2ee.com".regionMatches(11,"hello",0,7) =false