private int lastIndexOf(String what, String text) {
int offset;
int index;
for (offset = text.length(), index = text.indexOf(what, offset); offset >= 0 && index == -1; offset --)
index = text.indexOf(what, offset);
return index;
}