如何在NSString中搜索字符U-FFFD(黑钻石问号)?

时间:2011-03-11 08:21:07

标签: objective-c nsstring character

我有问题。我想用白色空格更改黑钻石问号(U-FFFD)。我怎么能搜索角色(黑钻石问号)所以我可以用白色空间改变它?谢谢你的关注。

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

用问号解决黑钻石。

只需使用:

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.