With methods it looks like this:
String srt = "Hello world it is my first program "; String aa[] = srt.split(" "); for (int i = 0; i < aa.length; i++) { System.out.println(aa[i]); } System.out.println(); char che = 'o'; String tar; for (int i = 0; i < aa.length; i++) { tar = aa[i]; char[] oo = tar.toCharArray(); for (int j = 0; j < oo.length; j++) if (oo[j] == che) { String y = aa[i]; System.out.println(y); break; } }
tar oo y
variables. And if the task is without methods from theString
class, for example, by the regular\\s[^\\s]*o[^\\s]*\\s
- pavel