2014년 11월 19일 수요일

[RegExp] Non-breaking space (char code 160) replace

- Non-breaking space
- ASCII character 160
- char code 160
- &#160
- \u00A0
- %A0
-   

볼때는 일반적인 공백으로 보이지만 따로 처리해줘야 할 경우가 생겼다.
 

RegExp = /\u00A0/  or  / /

value = value.replace(/\u00A0/g, ' ');
or
value = value.replace(/ /g, ' ');
 
 
출처 :
http://stackoverflow.com/questions/3794919/replace-all-spaces-in-a-string-with
http://www.adamkoch.com/2009/07/25/white-space-and-character-160/

댓글 없음:

댓글 쓰기