检查一个字符串是否为另一字符串的循环。
要找到一个字符串是另一个字符串的循环,将第一个字符串连接到它本身两次,并找到天气
示例
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");
}
}
}
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP