replaceFirst static method
Replaces the first occurrence of search with replace in subject.
Implementation
static String replaceFirst(String search, String replace, String subject) {
if (search.isEmpty) return subject;
final index = subject.indexOf(search);
if (index == -1) return subject;
return subject.replaceFirst(search, replace, index);
}