如何在 Xcode 4 的 GDB 输出窗口中显示 Invisibles?
我刚刚发现由于字符串长度不匹配而导致的字符串相等错误。额外的字符是“\r”,它根本不会显示在 Xcode 4 的输出窗口中。如果确实如此,我就不必花费那么多时间来追踪问题。
是否可以在输出窗口中显示空白字符?如果可以的话,我要念什么咒语才能实现呢?
我尝试在编辑器菜单下显示不可见内容,但这仅适用于代码编辑器,不适用于输出窗口。我在 iOS 应用程序上使用 Xcode 4。
I just tracked down a string equality bug due to string length mismatch. The extra character was '\r' which doesn't show up in the output window in Xcode 4 at all. If it had, I wouldn't have to spend nearly as much time as I did tracking the issue down.
Is it possible to show whitespace characters in the output window? If so, what magic incantation must I recite to enable it?
I tried Show Invisibles under the Editor menu, but that only worked for the code editors, not the output window. I'm using Xcode 4 on an iOS app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我现在只能想到一种解决方案:创建一个类别:
NSString+myAdditions.h
NSString+myAdditions.m
用法
输出
I can think of only one solution right now: Creating a category:
NSString+myAdditions.h
NSString+myAdditions.m
Usage
Output
您可以对字符串进行百分比转义。您可以在第三个参数中指定哪些字符不转义(我包括了所有常见的字符),其余字符将被转义:
You could percent-escape your string. You can specify which characters to not escape in the third parameter (I included all of the common ones), the rest of which will be escaped: