removeSpecialCharactersAroundWords function

String removeSpecialCharactersAroundWords (
  1. String string
)

Returns string after removing each word's surrounding special characters.

Implementation

String removeSpecialCharactersAroundWords(String string) {
  var separator = ' ';
  List<String> words = string.split(separator);
  var newWords = <String>[];
  for (var word in words) {
    newWords.add(removeSurroundingSpecialCharacters(word));
  }
  return newWords.join(separator);
}