So konvertieren Sie die Zeichenfolge in JavaScript in Pascal -Fall
const pascalCase = (string) => {
function toPascalCase(string) {
return `${string}`
.replace(new RegExp(/[-_]+/, "g"), " ")
.replace(new RegExp(/[^\w\s]/, "g"), "")
.replace(
new RegExp(/\s+(.)(\w*)/, "g"),
($1, $2, $3) => `${$2.toUpperCase() + $3.toLowerCase()}`
)
.replace(new RegExp(/\w/), (s) => s.toUpperCase());
}
const newText = toPascalCase(string);
return newText
};
mrmalik610