Last active
August 20, 2020 14:30
-
-
Save encikpulasan/18fb75c3bac1bd8e881fef3078ead66e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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