0
I wanted to print out only words that have :
in front
Example: Coisa1:kit1:Coisa2:kit2;grupo;grupo2;grupo3
would appear only: Coisa1 kit1 Coisa2 kit2
public static void main(String[] args) {
String s = "Coisa1:kit1:Coisa2:kit2;grupo;grupo2;grupo3";
String[] splitado1 = s.split(":");
for (int i = 2; i < splitado1.length; i++) {
System.out.println(splitado1[i]);
}
}
It worked rafael, as I do now to catch only the "groups" ?
– Luiz
Again using the given example, the simplest is to swap with: String[] splitt1 = str.substring(str.indexof(";")+1). split(";"); However, as said, if you have other examples you are able to break. You have to.
– Rafael B.
Thanks Ray, it worked.
– Luiz