diff --git a/Client/src/Utils/stringUtils.js b/Client/src/Utils/stringUtils.js index 43ae5ed54..0bf7aaf11 100644 --- a/Client/src/Utils/stringUtils.js +++ b/Client/src/Utils/stringUtils.js @@ -15,3 +15,22 @@ export const capitalizeFirstLetter = (str) => { } return str.charAt(0).toUpperCase() + str.slice(1); }; + +/** + * Helper function to get first letter as a lower case string + * @param {string} str String whose first letter is to be lower cased + * @returns A string with first letter lower cased + */ + +export const toLowerCaseFirstLetter = (str) => { + if (str === null || str === undefined) { + return ""; + } + if (typeof str !== "string") { + throw new TypeError("Input must be a string"); + } + if (str.length === 0) { + return ""; + } + return str.charAt(0).toLowerCase() + str.slice(1); + }; \ No newline at end of file