I have a string which contains square boxes
(I found it's开发者_如何学Python ascii code as alt+207
)...
How can I replace this with ' '(a single space).
I am assuming you mean the character: ¤
If so, you could try,
str = str.replace('\u00A4', ' ');
Or if you want to do it to any character that is not ASCII, you could try something like:
str = str.replace(/[^\u000A\u0020-\u007E]/g, ' ');
Is it one of these characters? ▪
= ▪ or ■
= ■
If so, you can do this
var str ="Something ▪ and ■";
str = str.replace(/▪|■/g, " ");
document.write(str);
http://jsfiddle.net/jasongennaro/8mCuV/
精彩评论