0

I need to get the uppercase (or lowercase) of a string in Javascript, but that string can contain special characters of any alphabet in UTF-8 (for example, spanish ñ or ç, german ä, ö or ü, etc.).

How can I get this?

Paolo
15.9k28 gold badges73 silver badges95 bronze badges
asked Feb 27, 2017 at 8:59
4
  • 3
    May be the plain .toUpperCase()? Commented Feb 27, 2017 at 9:00
  • 4
    "ñ".toUpperCase() Commented Feb 27, 2017 at 9:00
  • 1
    There’s .toLocaleUpperCase(), but it uses the current locale; you can’t set it. Commented Feb 27, 2017 at 9:10
  • I didn't thought it was so easy ☺ Commented Feb 27, 2017 at 9:28

1 Answer 1

3

You would use toUpperCase():

console.log('ñç'.toUpperCase());

answered Feb 27, 2017 at 9:08
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.