Search code examples
javascriptlodashuppercaseaccent-sensitive

Lodash: is there a way to uppercase a word keeping accents with lodash?


Is there a lodash function that would transform "répété" => "RÉPÉTÉ" instead of "REPETE" as it's done by the uppercase function?

If not, what's an easy way to perform this in Javascript?


Solution

  • You could use toLocaleUpperCase()

    const str = 'répété';
    const ret = str.toLocaleUpperCase();
    console.log(ret);