如何替换NSString中的\xA0字符 [英] How to replace \xA0 characters in an NSString

查看:3179
本文介绍了如何替换NSString中的\xA0字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码无效:

NSString *importText = [textView.string stringByReplacingOccurrencesOfString:@"\xA0\xA0"
 withString:@" "];

编译器声明:
输入转换因不属于输入字节而停止到输入代码集UTF8

Compiler claims: "Input conversion stopped due to an input byte that don't belong to the input code set UTF8"

推荐答案

尝试Unicode转义序列 \\\ 

Try the Unicode escape sequence \u00a0.

这篇关于如何替换NSString中的\xA0字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆