If you want the first char to be uppercase, you could check and trim the input first, then change it to something like:
substring(toUpperCase($inputString), 0, 1) + substring(toLowerCase($inputString), 1)
Check out the substring and other string functions in the documentation.
Edit: correction applied
Or you can use a JS Action to convert the String, as shown in the picture below:
JSA_ConvertToCamelCase
export async function JSA_ConvertToCamelCase(text) {
// BEGIN USER CODE
return text
.replace(/\s(.)/g, function (a) {
return a.toUpperCase();
})
.replace(/\s/g, '')
.replace(/^(.)/, function (b) {
return b.toLowerCase();
});
// END USER CODE
}
JSA_ConvertToPascalCase
export async function JSA_ConvertToPascalCase(text) {
// BEGIN USER CODE
return text.replace(/(\w)(\w*)/g,
function(g0,g1,g2){
return g1.toUpperCase() + g2.toLowerCase();
}).replace(/\s/g, '');
// END USER CODE
}