objective c - IOS How to remove Zero Width Space [ E2 80 8B ] from NSString -


with copy/paste, 1 of clients put in textfield of ios app text containing 0 width space [ e2 80 8b ] , want remove them.

here's example of text : basse ​température ​avec ​dégivrage ​électrique

what tried :

nsstring* zarb = [nsstring stringwithformat:@"%c%c%c",0xe2,0x80,0x8b]; nsstring*resu=[ch stringbyreplacingoccurrencesofstring:zarb withstring:@""]; // not work  if ([ch rangeofstring:zarb].location != nsnotfound) {       // not work } 

the hexa sequence in string cannot remove it. has got problem ?

the "zero width space" unicode character \u200b. e2 80 8b utf-8 encoding.

try this:

nsstring* zarb = @"\u200b"; nsstring* resu = [ch stringbyreplacingoccurrencesofstring:zarb withstring:@""]; 

btw - attempt do:

nsstring* zarb = [nsstring stringwithformat:@"%c%c%c",0xe2,0x80,0x8b]; 

results in invalid string because there no unicode characters 80 , 8b.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -