VB换行符? [英] VB newline escape char?
问题描述
在C中,我使用第一行1 \\\
换行,但是VB呢?我知道
2nd行第一行& VbCrLf&
我想打印
第一行
第二行
我尝试使用 \\\
但它总是输出这个无论多少次我运行编译器
第一行第\\\
2nd行
c> 您应该使用 Environment.NewLine
。在Windows上计算为CR + LF,在Unix系统上计算为LF。
在VB中没有CR或LF字符的转义序列。这就是为什么\\\
被逐字处理。所以, Environment.NewLine
是你的家伙。
In C I use "1st line 1\n2nd line"
for a newline, but what about VB? I know "1st line" & VbCrLf & "2nd line"
but its too verbose, what is the escape char for a newline in VB?
I want to print
1st line
2nd line
I tried using \n
but it always outputs this no matter how many times I run the compiler
1st line\n2nd line
Any ideas?
You should use Environment.NewLine
. That evaluates to CR+LF on Windows, and LF on Unix systems.
There are no escape sequences for CR or LF characters in VB. And that's why "\n"
is treated literally. So, Environment.NewLine
is your guy.
这篇关于VB换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!