SUBSTRING_BEFORE
Examples:
int i = ttt.indexOf("r");
ttt.substring(0, i);
...
ttt.substring(0, ttt.indexOf("r"));
...
Can be refactored as:
StringUtils.substringBefore(ttt, "r")
library: Apache commons-lang
JavaDoc
Download
See also: SUBSTRING_AFTER