diff --git a/resources/js/helpers/string.ts b/resources/js/helpers/string.ts index cae6292..6b60acf 100644 --- a/resources/js/helpers/string.ts +++ b/resources/js/helpers/string.ts @@ -5,7 +5,7 @@ * @returns {string} A string transformed to title case. */ export const toTitleCase = (str: string): string => { - return str.replace(/\b\w+\b/g, function (txt) { + return str.replace(/[_-]+/g, " ").replace(/\b\w+\b/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase(); }); };