[英]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?是否有一个
lodash
function 可以转换"répété" => "RÉPÉTÉ"
而不是像uppercase
function 所做的那样"REPETE"
?
If not, what's an easy way to perform this in Javascript?如果没有,在 Javascript 中执行此操作的简单方法是什么?
Well you have a native function called "toLocaleUpperCase()"那么你有一个本地 function 叫做“toLocaleUpperCase()”
you can do this:你可以这样做:
const str = 'répété'; const ret = str.toLocaleUpperCase(); alert(ret);
docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase文档: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase
You could use toLocaleUpperCase()
你可以使用
toLocaleUpperCase()
const str = 'répété'; const ret = str.toLocaleUpperCase(); console.log(ret);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.