Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save encikpulasan/18fb75c3bac1bd8e881fef3078ead66e to your computer and use it in GitHub Desktop.
Save encikpulasan/18fb75c3bac1bd8e881fef3078ead66e to your computer and use it in GitHub Desktop.
extension CapExtension on String {
//first letter only
String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
//all letter in string
String get allInCaps => this.toUpperCase();
//first letter for each word in a string
String get titleCase => this
.split(' ')
.map((word) => word[0].toUpperCase() + word.substring(1))
.join(' ');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment