如何让 Visual Studio 的立即窗口给我纯字符串输出? [英] How to make Visual Studio's Immediate window give me plain string output?

查看:33
本文介绍了如何让 Visual Studio 的立即窗口给我纯字符串输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在 Immediate 中计算产生一个长而复杂的字符串的东西,调试器会用 C 字符串转义对所有内容进行编码,所以我最终会得到一堆 \n, \t,等等,然后我必须手动修复我的文本.(这在 \n 的情况下特别烦人,因为大多数文本编辑器无法进行多行搜索和替换!)

If I evaluate something in Immediate that produces a long and complex string, the debugger encodes everything in C string escapes, so I end up with a mess of \n, \t, and so on throughout my text which I then have to fix by hand. (Which is particularly annoying in the case of \n, as most text editors can't do multiline search-and-replace!)

有什么方法可以让调试器给我原始的、未经处理的、多行字符串值?

Is there any way to get the debugger to give me the raw, un-munged, multi-line string value?

推荐答案

我们可以在 Watch 窗口中使用 Text Visualizer 查看字符串值,它会显示没有任何 \n 和 \t 内容的字符串值.

We could check the string value with Text Visualizer in Watch window, which will show the string value without any \n and \t content.

请在代码中的字符串变量中添加断点并开始调试代码.当断点命中时,您可以右键单击该变量并选择添加监视",然后按 F11 转到下一行代码.现在您可以通过单击文本可视化器"图标从监视窗口查看字符串值.它不会显示 \n 和 \t.

Please add a breakpoint in the string variable in your code and start debugging your code. When the breakpoint hit, you could right-click the variable and choose "Add Watch" Then press F11 to go to next line of code. Now you could view the string value from Watch window by click the "Text Visualizer" icon. It will not show the \n and \t.

这篇关于如何让 Visual Studio 的立即窗口给我纯字符串输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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