10 lines
400 B
TypeScript
10 lines
400 B
TypeScript
function convertCamelCaseToReadable(camelCaseString: string): string {
|
|
// Split the string using regex to match the capital letters
|
|
const wordsArray = camelCaseString.split(/(?=[A-Z])/);
|
|
|
|
// Capitalize the first letter of each word and join the words with a space
|
|
const readableString = wordsArray.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
|
|
return readableString;
|
|
}
|