rightStrip method
The string without any trailing whitespace and optional character
Implementation
String rightStrip([String? character]) {
final String trimmed = trimRight();
if (character != null && trimmed.endsWith(character)) {
return trimmed.substring(0, trimmed.length - 1);
}
return trimmed;
}