Last active
January 10, 2019 22:53
-
-
Save zaidaldabbagh/53dcfb2b63145efa346c8366685a211c to your computer and use it in GitHub Desktop.
Convert CamelCase to SentenceCase — https://stackoverflow.com/questions/7225407/convert-camelcasetext-to-sentence-case-text
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
function camelCaseToSentenceCase(word) { | |
const result = word.replace(/([A-Z])/g, ' $1'); | |
const finalResult = result.charAt(0).toUpperCase() + result.slice(1); | |
return ( | |
<span>{finalResult}</span> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment