Updated the writing exam to work based on exercises instead of just a single one

This commit is contained in:
Tiago Ribeiro
2023-04-17 13:03:48 +01:00
parent 5df816c73c
commit 207328dade
9 changed files with 359 additions and 74 deletions

9
src/utils/string.ts Normal file
View File

@@ -0,0 +1,9 @@
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;
}