Use the RegionMatches (int Toffset, String Other, Int Ooffset, int LEN) method in the String class

xiaoxiao2021-03-06  43

package ch7; import java.util.Vector; public class Untitled1 {public Untitled1 () {} public static void main (String [] args) {Untitled1 u = new Untitled1 (); String str = "123456789"; String temp = " 123456789 "; Boolean Bool = Str.RegionMatches (2, TEMP, 3, 3);

// TOFFSET - The start offset of the sub-area in the string. // Other - String parameters. // OOFFSET - The start offset of the subregion in the parameter string. // LEN - The number of characters to be compared. // Returns true if the specified sub-area of ​​the string is accurately matched in the specified subregion in the parameter string, otherwise returns false. // Str> Temp Returns false // str = Temp Returns TRUESYSTEM.Println (bool);}}

转载请注明原文地址:https://www.9cbs.com/read-72803.html

New Post(0)