Problem with the toLowerCase and toUpperCase function

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
Monomone
Curious Newbie
Curious Newbie
Posts: 3
Joined: Wed Oct 19, 2022 10:53 pm

Problem with the toLowerCase and toUpperCase function

Post by Monomone »

Hey guys I'm trying to make my first webtease but I'm encountering a problem. I have taken the name of the player with a prompt and saved it to a variable called 'name'. I want this to always have a capital first letter and the rest lowercase (because it's a name) and I've tried to do that using an eval with as seen in the picture below. When I tested it by using a say command that said : 'name2'. When I filled in jAmES (not my real name) it returned me exactly what I put in. What am I doing wrong?
Knipsel.PNG
Knipsel.PNG (8.95 KiB) Viewed 841 times
Monomone
Curious Newbie
Curious Newbie
Posts: 3
Joined: Wed Oct 19, 2022 10:53 pm

Re: Problem with the toLowerCase and toUpperCase function

Post by Monomone »

Okay now it just gives me the capital letter J (using James)??????
Monomone
Curious Newbie
Curious Newbie
Posts: 3
Joined: Wed Oct 19, 2022 10:53 pm

Re: Problem with the toLowerCase and toUpperCase function

Post by Monomone »

fixed it :)
Ended up using the following script with a prompt saving to 'inputname'
name1 = inputname.toLowerCase();
name = name1.charAt(0).toUpperCase() + name1.slice(1);
Post Reply

Who is online

Users browsing this forum: No registered users and 60 guests