I have an string like this:
var set = 'ñ This is a Test Ñ';
What I need to do is replace ñ
and Ñ
with n
. I tried:
set.replace(/\u00F1/g, 'n');
but it only replaces the ñ
.
I have an string like this:
var set = 'ñ This is a Test Ñ';
What I need to do is replace ñ
and Ñ
with n
. I tried:
set.replace(/\u00F1/g, 'n');
but it only replaces the ñ
.
- The variable Set is obtained from a input Value, I know u00F1 = ñ And u00D1 = Ñ – Jonathan Edgardo Commented Sep 10, 2011 at 18:05
1 Answer
Reset to default 6I think there is a cleaner way to write this, but this should work. The |
acts as an OR
in regex.
a = set.replace(/\u00F1|\u00D1/g, 'n');
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744097977a4558295.html
评论列表(0条)