How to search character U-FFFD (black diamond question mark) in NSString?

隐身守侯 提交于 2019-12-25 04:32:10

问题


I have a problem. I want to change the black diamond question mark (U-FFFD) with white space. How could I search the character (black diamond question mark) so I can change it with white space? Thank you for your attention.


回答1:


[theString stringByReplacingOccurrencesOfString:@"\ufffd" withString:@" "];



回答2:


Solve black diamond with question mark.

just use this:

foreach($disp as $objs)
{

    $objs = preg_replace( '|[^.?,A-Za-z0-9-]+|', ' ', $objs);
    echo $objs;
}

// this will display character (.?A-Z AND 0-9) and replace char other than this.


来源:https://stackoverflow.com/questions/5270534/how-to-search-character-u-fffd-black-diamond-question-mark-in-nsstring

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!