start static method

String start(
  1. String value,
  2. String prefix
)

Begins value with a single instance of prefix.

Implementation

static String start(String value, String prefix) {
  if (prefix.isEmpty) return value;
  final stripped = value.replaceAll(
    RegExp('^(?:${RegExp.escape(prefix)})+'),
    '',
  );
  return '$prefix$stripped';
}