toPascalCase method

String toPascalCase()

Converts this string to PascalCase.

'hello world'.toPascalCase();      // "HelloWorld"
'hello_world'.toPascalCase();      // "HelloWorld"

Implementation

String toPascalCase() {
  final words = _splitWords();
  return words.map((w) => w.isEmpty ? '' : '${w[0].toUpperCase()}${w.substring(1).toLowerCase()}').join();
}