toSmallCaseText property
String
get
toSmallCaseText
Converts the string to small case text.
- This method splits the string by spaces, hyphens, or underscores, and converts each word to lowercase.
- Returns a new string with all letters in lowercase, separated by spaces.
Example:
"Hello_World".toSmallCaseText; // Returns "hello world"
Returns: A String in small case text.
Implementation
String get toSmallCaseText {
List<String> words = split(RegExp(r'[-_]'));
for (int i = 0; i < words.length; i++) {
words[i] = words[i].isEmpty ? '' : words[i].toLowerCase();
}
return words.join(' ');
}