0
function toCamelCase(str) {
    // Convert the entire string to lowercase
    return str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, function(match, group1) {
        // For each match, convert the first character of the match to uppercase
        return group1.toUpperCase();
    }).replace(/^[^a-zA-Z0-9]+/g, ''); // Remove any non-alphanumeric characters from the beginning of the string
}

I have been trying this code. But the problem is if the provided string is with a number or has any other character that should be removed. I couldn't build this logic. Can anyone explain how can i do this? [tag:I have seen some solution but that can not filter the number.]

3

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.