| 目次 |
|---|
|
・文字列に指定した文字が含まれるか調査 ・検証 ・検証結果 |
public class Test{
public static void main(String[] args) {
String str = new String("abcd.");
if(str.indexOf(".") == -1){
System.out.println("含まれない");
}else{
System.out.println("含まれる位置は"+ str.indexOf("."));
}
}
}
含まれる位置は4