splitWithMultipleDelimitersManual method

List<String> splitWithMultipleDelimitersManual(
  1. List<String> delimiters
)

Implementation

List<String> splitWithMultipleDelimitersManual(List<String> delimiters) {
  final List<String> words = [];
  String currentWord = "";
  for (int i = 0; i < length; i++) {
    final char = this[i];
    if (delimiters.contains(char.toString())) {
      if (currentWord.isNotEmpty) {
        words.add(currentWord);
        currentWord = "";
      }
    } else {
      currentWord += char;
    }
  }
  if (currentWord.isNotEmpty) {
    words.add(currentWord);
  }
  return words;
}