Dev_Tip/Java_Tip
-
[Java] 특정 문자열 검색하기Dev_Tip/Java_Tip 2021. 3. 10. 10:16
✔ 특정 문자열 검색하기 -contains -indexOf String testStr = "동해물과 백두산이"; System.out.println( "contains 동해 : " + testStr.contains("동해") ); System.out.println( "contains 서해 : " + testStr.contains("서해") ); System.out.println( "indexOf 동해 : " + testStr.indexOf("동해") ); System.out.println( "indexOf 서해 : " + testStr.indexOf("서해") );