toPascalCase method

String toPascalCase()

Convert string to pascal case.

Implementation

String toPascalCase() {
  if (this == null) {
    throw ArgumentError('string: $this');
  }
  return this!.splitMapJoin(RegExp(r'[_\s]+'),
      onMatch: (match) => match.group(0)!.toUpperCase(),
      onNonMatch: (nonMatch) =>
          nonMatch[0].toUpperCase() + nonMatch.substring(1).toLowerCase());
}