toPascalCase method

String toPascalCase()

Converts a string to PascalCase.

'hello_world'.toPascalCase() // 'HelloWorld'

Implementation

String toPascalCase() {
  if (isEmpty) return '';
  return trim().split(RegExp(r'[\s_\-]+')).map((w) => w.capitalize()).join();
}