My Code:
String Y = "part1 part2 part3", X = "part1";
boolean foundMatch = false;
while(!foundMatch) {
    foundMatch = Y.equals(X);
    if(foundMatch) {
        break;
    }
    else {
        Y = useSplitToRemoveLastPart(Y);
        if(Y.equals("")) {
            break;
        }
    }
Implementation of useSplitToRemoveLastPart()
private static String useSplitToRemoveLastPart(String y) {
    // What goes here?
    // It should chop the last part of the String...
}
Can anyone help ...