Created
November 8, 2016 01:17
-
-
Save mkdika/c424fdb947753892e72dce25b3ff9c5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LiteralStringSearch { | |
/* | |
Contoh String literal keyword search di Java. | |
Baik data maupun keyword di normalisasi dulu ke huruf kecil semua (lowercase) | |
baru dibandingkan dengan method: contains bawaan dari API java.lang.String | |
*/ | |
public static void main(String[] args) { | |
String[] data = {"Jack Man", "Budi Man", "Andy Gunaman", "Denny Tejo", | |
"Sofyan", "Fendy Agus","Mandra"}; | |
String keyWord = "MAN"; | |
for (String d : data) { | |
if (d.toLowerCase().contains(keyWord.toLowerCase())) { | |
System.out.println("Founded Key Word! " + d); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment