toPascalCase method

String toPascalCase()

Converts this string to PascalCase

Example:

print('hello world'.toPascalCase()); // "HelloWorld"
print('hello-world'.toPascalCase()); // "HelloWorld"

Implementation

String toPascalCase() {
  if (isEmpty) return this;
  return split(RegExp(r'[\s\-_]+')).map((word) => word.capitalize()).join('');
}