MutableInteger mi = new MutableInteger(); String text = "Hello, World"; char c = 'W"; if (parse(text, c, mi)) { System.out.println("Character " + c + " found at offset " + mi + " in " + text); } else { System.out.println("Not found"); }
This is the function that has a return value of true but also "passes back" the offset into the String where a value was found. Contrived example! int i = in.indexOf(lookFor); if (i == -1) return false; // not found whereFound.setValue(i); // say where found return true; // say that it was found
int i = in.indexOf(lookFor); if (i == -1) return false; // not found whereFound.setValue(i); // say where found return true; // say that it was found