foldNativeLabel function

String foldNativeLabel(
  1. String s
)

Lowercases and folds typographic variants, so Don't allow matches Don’t allow: curly quotes become straight ones, no-break spaces become spaces.

Implementation

String foldNativeLabel(String s) => s
    .replaceAll(RegExp('[\u2018\u2019]'), "'")
    .replaceAll(RegExp('[\u201C\u201D]'), '"')
    .replaceAll('\u00A0', ' ')
    .trim()
    .toLowerCase();