函不函數的,到底在敘述什麼...?
也不說是用什麼寫的
隨意用個語言給你參考,自己猜
String s = "hello";
if(s.Pos("l") > 0)
// do something
看起來是要這樣吧
沒用IDE直接手打,報錯請包涵
public static void main(String[] args){
String s1 = "abccba";
String s2 = "cc";
String result = isSubString(s1,s2)?"包含":"不包含";
System.out.println(result);//包含
}
public static boolean isSubString(String s1,String s2){
return s1.contains(s2);
}
public static void main(String[] args){
String s1 = "abc";
String s2 = "cba";
String result = isReverseStr(s1,s2)?"是":"否";
System.out.println(result);//是
}
public static boolean isReverseStr(String s1,String s2){
return s2.equals(s1.reverse());
}