作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我在 Go Playground 中运行这段代码:
fmt.Println(strings.ContainsRune("\xa0", '\xa0'))
我想知道,为什么会输出false
?根据docs ,它说:
ContainsRune returns true if the Unicode code point r is within s.
在我看来代码点就在那里,它会给出 false
作为响应似乎很奇怪。
最佳答案
"\x0a"不是 unicode 代码点。
fmt.Println(strings.ContainsRune("\u00a0", '\u00a0'))
按预期工作。
关于unicode - ContainsRune 给出奇怪的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25775022/
我在 Go Playground 中运行这段代码: fmt.Println(strings.ContainsRune("\xa0", '\xa0')) 我想知道,为什么会输出false?根据docs
我是一名优秀的程序员,十分优秀!