I have a string like
↵my name is Pankaj↵
I want to remove the ↵
character from the string.
"↵select * from eici limit 10".replace("↵", "")
Works fine. But I want to know if there is any other way to remove these kind of unnecessary characters.
Instead of using the literal character, you can use the codepoint.
Instead of "↵"
you can use "\u21b5"
.
To find the code, use '<character>'.charCodeAt(0).toString(16)
, and then use like \u<number>
.
Now, you can use it like this:
string.split("\u21b5").join(''); //split+join
string.replace(/\u21b5/g,''); //RegExp with unicode point
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With