Unicode 转义后花括号中的预期十六进制代码 [英] Expected hexadecimal code in braces after unicode escape

查看:50
本文介绍了Unicode 转义后花括号中的预期十六进制代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这在 Swift 的第一个测试版中有效.

This worked in the first beta of Swift.

var degree = "\u00B0" // degree symbol

现在我收到了这个错误,我不明白我需要做什么才能在 Xcode 6 Beta 5 中更正它.

Now I'm getting this error and I don't understand what I need to do to correct it in Xcode 6 Beta 5.

Expected hexadecimal code in braces after unicode escape

推荐答案

正确的代码是:

var degree = "\u{00B0}" // degree symbol

来自 Xcode 6 beta 4 发行说明:

From the Xcode 6 beta 4 release notes:

字符串文字中的 \x、\u 和 \U 转义序列已合并为一个和不易出错的 \u{123456} 语法.(17279286)

The \x, \u and \U escape sequences in string literals have been consolidated into a single and less error prone \u{123456} syntax. (17279286)

这篇关于Unicode 转义后花括号中的预期十六进制代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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