Created
February 2, 2023 11:23
-
-
Save BekNaji/cd6ae8dee0756e9c47028619b8db441f to your computer and use it in GitHub Desktop.
Capitalize text in dart
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
// SOFTWARE developer ----> Software Developer | |
String capitalizeAllWord(String val) { | |
var value = val.toLowerCase(); | |
var result = value[0].toUpperCase(); | |
for (int i = 1; i < value.length; i++) { | |
if (value[i - 1] == " ") { | |
result = result + value[i].toUpperCase(); | |
} else { | |
result = result + value[i]; | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment