Hello

I want to remove this:

As you see it is a blank but the regular variable.replace(/\s+/g,''); does not work. I generate this character with Alt+0160 The best way would be its ascii code so how do I do it?

Recommended Answers

All 5 Replies

http://en.wikipedia.org/wiki/Non-breaking_space

A little digging suggests something like variable.replace(/\xc2\xa0/g, '') as a solution with the way I assume you're handling encodings. You may need to tweak the code a bit as I'm not super hip with Javascript.

taking the plus out would replace all whitespace chars with nothing

variable.replace(/\s/g,"");

if it's not working maybe there's something in the code surrounding this that needs debugging.

taking the plus out would replace all whitespace chars with nothing variable.replace(/\s/g,""); if it's not working maybe there's something in the code surrounding this that needs debugging.

It doesnt work for that character

How about

str = str.replace(/\u0160/g,"");
commented: That was it +4

Yup, that solves it theHop

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.