replaceMapValue static method

String replaceMapValue(
  1. String input,
  2. Map<String, String> mapPattern
)

Replaces patterns in string using a map @param input The input string @param mapPattern Map of patterns to replacements @returns String String with replaced patterns Example: PersianTools.replaceMapValue("شیش صد", {"شیش صد": "ششصد"}) => "ششصد"

Implementation

static String replaceMapValue(String input, Map<String, String> mapPattern) => input.replaceAllMapped(
      RegExp(mapPattern.keys.join("|"), caseSensitive: false),
      (Match match) => mapPattern[match.group(0)]!,
    );