Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you replace a pound (currency) sign in javascript?

Tags:

javascript

I'm trying to remove a pound sign (£) from a string using javascript. I'm trying to do it using

str = str.replace(/\£/g, "");

However, it is not removing the sign.

The value of str is being fetched from a span (and the correct value is being fetched). This span has been previously set using javascript, with it being encoded in the string as

£

Any ideas on the best way to remove the pound sign?

like image 478
Lee Avatar asked Sep 14 '11 15:09

Lee


People also ask

How do I insert a pound symbol?

Inserting the pound symbol using an Alt keyboard shortcutPress and hold Alt + 0163 or Alt + 156 on the numeric keypad.

Is a pound sign a special character?

The pound symbol (#), also known by many other names that include pound sign, number sign, hash mark, and hashtag, is a typographical symbol that is rarely used in formal writing. However, this symbol is used often in informal writing, specifically on social media.

How do you write pound?

In the Unicode standard, the symbol £ is called POUND SIGN, and the symbol ₤ is the LIRA SIGN.


1 Answers

You may need to use unicode for this. E.g., '£10.00'.replace(/\u00A3/g, '');

like image 51
jmar777 Avatar answered Nov 07 '22 09:11

jmar777