toTrainCase method
Converts a string to Train-Case.
'hello world'.toTrainCase() // 'Hello-World'
Implementation
String toTrainCase() {
if (isEmpty) return '';
return split(RegExp(r'[\s_\-]+')).map((w) => w.capitalize()).join('-');
}
Converts a string to Train-Case.
'hello world'.toTrainCase() // 'Hello-World'
String toTrainCase() {
if (isEmpty) return '';
return split(RegExp(r'[\s_\-]+')).map((w) => w.capitalize()).join('-');
}