Created
May 15, 2019 16:22
-
-
Save pandauxstudio/011142d58570b6b45343e4609e587667 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