wordsSplit function
Splits text into words and returns them as a list of strings.
This is a convenience function that calls wordsDetect and returns only the word array. Use this when you need access to the individual words.
Supports 85+ languages with proper handling for different writing systems. Returns an empty list for null, empty, or whitespace-only text.
Example:
List<String> words = wordsSplit('Hello World'); // ['Hello', 'World']
List<String> chinese = wordsSplit('你好世界'); // ['你', '好', '世', '界']
List<String> mixed = wordsSplit('Hello, 你好!'); // ['Hello', '你', '好']
// With configuration
const config = WordCountConfig(punctuationAsBreaker: true);
List<String> words2 = wordsSplit("don't", config); // ['don', 't']
Implementation
List<String> wordsSplit(
String? text, [
WordCountConfig config = const WordCountConfig(),
]) {
final result = wordsDetect(text, config);
return result.words;
}