replaceBeforeLast method
Replaces everything before the last occurrence of pattern.
Implementation
String replaceBeforeLast(String pattern, String replacement) {
final i = lastIndexOf(pattern);
if (i == -1) return this;
return replacement + substring(i);
}