trimStringLeft method

String trimStringLeft(
  1. String chars
)

Trims the characters given by chars from before String.

Stringの前からcharsで与えられた文字をトリムします。

final text = "__text___";
final trimed = text.trimString("_"); // "text___"

Implementation

String trimStringLeft(String chars) {
  final pattern = chars.isNotEmpty ? RegExp("^[$chars]+") : RegExp(r"^\s+");
  return replaceAll(pattern, "");
}