Scala String regionMatches(int toffset, String other, int offset, int len) 方法示例
regionMatches(int toffset, String other, int offset, int len)方法用于检查两个字符串区域是否相等。但是,这里不包括ignoreCase 。
Method Definition:Boolean regionMatches(int toffset, String other, int offset, int len)
Return Type: It returns true if two string region matches else it returns false.
示例 #1:
// Scala program of int regionMatches()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying regionMatches method
val result = "Preeti".regionMatches(0, "Preeti", 0, 4)
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program of int regionMatches()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying regionMatches method
val result = "Preeti".regionMatches(0, "pReeti", 0, 4)
// Displays output
println(result)
}
}
输出:
false