replacePunctuationWithWhiteSpace method Null safety

String replacePunctuationWithWhiteSpace()

Replace all punctuation in the String with whitespace.

Implementation

String replacePunctuationWithWhiteSpace() =>
    replaceAll(RegExp(EnglishConstants.reSentenceEndingSelector), ' ')
        .replaceAll(RegExp(EnglishConstants.rePunctuationSelector), ' ')
        // replace all brackets and carets with _kTokenDelimiter.
        .replaceAll(RegExp(EnglishConstants.reBracketsAndCarets), ' ')
        // replace all repeated white-space with a single white-space.
        .replaceAll(RegExp(r'(\s{2,})'), ' ');