Hello I am trying to make a Quipu system where 1 is -x- and 2 is -xx- so a number like -x-xxx-xx- should return 132.
I wrote this:
String q = "-x-xxx-xx-";
if(q.contains("-x-")) {
System.out.println(1);
}
if(q.contains("-xx-")) {
System.out.println(2);
}
if(q.contains("-xxx-")) {
System.out.println(3);
}
But it gives it in wrong order. I understand why because it finds the two before the three but if you could give me any ideeas how could i do it to give the exact String order. Thanks