string.replace against html symbol code (÷)? |
string.replace against html symbol code (÷)? |
CharliePrince |
Jan 9 2021, 03:38 AM
Post
#1
|
Novice Group: Members Posts: 24 Joined: 7-November 20 From: Saint Louis, MO Member No.: 27,623 |
I'm trying to replace an html symbol code '÷' with another string.
I can't get this to work. See example below. CODE <body> <p id='target'>A ÷ B</p> <script> console.log(`${document.getElementById('target').innerText}`); console.log(`${document.getElementById('target').innerText.replaceAll('÷', '/')} (want this to = 'A / B') `); console.log(`${document.getElementById('target').innerText.replaceAll('÷', '/')} (or, want this to = 'A / B') `); </script> </body> Can anyone help? Pandy? |
Christian J |
Jan 9 2021, 02:56 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,722 Joined: 10-August 06 Member No.: 7 |
Could it have something to do with ASCII or Unicode ranges? I don't know anything about that.
|
pandy |
Jan 9 2021, 02:58 PM
Post
#3
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,753 Joined: 9-August 06 Member No.: 6 |
But for example ← has been around as long as I have. Must be ascii?
|
pandy |
Jan 9 2021, 03:06 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,753 Joined: 9-August 06 Member No.: 6 |
The whole first column form here https://htmlhelp.com/reference/html40/entities/latin1.html . Only stands out.
https://htmlhelp.com/reference/html40/entities/symbols.html are all interpreted. |
Lo-Fi Version | Time is now: 25th September 2024 - 02:40 AM |