triNewLine static method

void triNewLine(
  1. ActionRecipe recipe
)

Trims spaces between and after a new line

Implementation

static void triNewLine(ActionRecipe recipe) {
  if (_newLineAroundSpace.hasMatch(recipe.receivedText)) {
    for (final match in _newLineAroundSpace.allMatches(recipe.receivedText)) {
      final subString = match.group(0) ?? "";
      final replace = match.group(1) ?? "";
      if (subString.isNotEmpty && replace.isNotEmpty) {
        recipe.receivedText =
            recipe.receivedText.replaceAll(subString, replace);
      }
    }
  }
}