cara menemukan karakter tertentu dalam string menggunakan array
public static void main(String[] args) {
String url = "[email protected]";
char key = '@';
char[] ch = url.toCharArray();
for (int i = 0; i < ch.length; i++) {
if (key == ch[i]) {
System.out.println(key + " is in index: "+i);
}
}
}
Chathumal Sangeeth