Jak znaleźć słowo w ciągu w Javie
String s = "I have an orange";
if (s.indexOf("orange") != -1){
System.out.println("orange found");
}
Innocent Iguana
String s = "I have an orange";
if (s.indexOf("orange") != -1){
System.out.println("orange found");
}
String s = "Java is great";
if (s.contains("Java"))
System.out.println("Java is found");