要查找天气,一个字符串是另一个字符串的旋转,将第一个字符串与自身连接两次,然后查找天气
public class Sample {
public static void main(String args[]){
String str1 = "gala";
String str2 = "alag";
String s3 = str1+str1;
if(s3.contains(str2)) {
System.out.println("str1 is rotation of str2");
} else {
System.out.println("str1 is not rotation of str2");
}
}
}