trimStringRight method
Trims the characters given by chars
from after String.
Stringの後からchars
で与えられた文字をトリムします。
final text = "__text___";
final trimed = text.trimString("_"); // "__text"
Implementation
String trimStringRight(String chars) {
final pattern = chars.isNotEmpty ? RegExp("[$chars]+\$") : RegExp(r"\s+$");
return replaceAll(pattern, "");
}