takeAfter method

String takeAfter(
  1. String search
)

Returns the substring after the first occurrence of search.

Returns an empty string if search is not found.

Example:

'path/to/file.txt'.takeAfter('/'); // returns: 'to/file.txt'

Implementation

String takeAfter(String search) {
  int index = indexOf(search);
  if (index < 0) {
    return '';
  } else {
    return substring(index + search.length);
  }
}