rightOf method
Returns the right side of the String
starting from char
.
If char
doesn't exist, null
is returned.
Example
String s = 'peanutbutter';
String foo = s.rightOf('peanut'); // returns 'butter'
Implementation
String? rightOf(String char) {
if (this.isBlank) {
return this;
}
int index = this!.indexOf(char);
if (index == -1) {
return null;
}
return this!.substring(index + char.length, this!.length);
}