before static method
What precedes the first search in subject, or all of it without
one.
Implementation
static String before(String subject, String search) {
final index = search.isEmpty ? -1 : subject.indexOf(search);
return index == -1 ? subject : subject.substring(0, index);
}