Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove char 8236

Tags:

string

c#

I'm trying to parse some phone numbers, and I have a function to check if the parsed string is made up of only numbers or the + sign.

In some of them there is an hiden character of value 8236.

enter image description here enter image description here

Comparing it against '\0' and '\u8236' doesnt work...

What is this character and how do I remove it?

like image 657
RagnaRock Avatar asked Jan 21 '18 12:01

RagnaRock


1 Answers

Thanks to @Maximilian Gerhardt who sent this link in a comment https://www.fileformat.info/info/unicode/char/202c/index.htm

I was able to know that 8236 corresponds to character '\u202c'

So I did str.Trim('\u202c') And it did work


edit:

The simple way to get the corresponding code is to convert from decimal to hex.

8236(decimal) -> 202C(hexadecimal)

like image 109
RagnaRock Avatar answered Oct 12 '22 11:10

RagnaRock