如何在 vb.net 中删除新行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17873416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove new line in vb.net
提问by GangOne Style
i have a problem to remove new line in vb .net.. ex:
我在删除 vb .net 中的新行时遇到问题。例如:
A
B
C
甲
乙
Ç
i've try this code
我试过这个代码
replace (string,chr(13),"*")
替换(字符串,chr(13),“*”)
and the result is
结果是
A*
*
B *
C
A*
*
B *
C
i want to remove the new line after i replaced the chr(13) like this:
我想在像这样替换 chr(13) 后删除新行:
A**B*C
甲**乙*丙
i use this code for help me in text encryption with vigenere cipher Help me please....
我使用此代码来帮助我使用 vigenere 密码进行文本加密 请帮助我....
回答by Mark Hall
回答by Arun Bertil
The following string contains carriage returns. In VB they are declared as "vbCrLf", so you can remove them with
以下字符串包含回车符。在 VB 中,它们被声明为“vbCrLf”,因此您可以使用
a = Replace(a, vbCrLf, "")
回答by Israel Ocbina
Example you have entered a string text like the one below:
例如,您输入了如下所示的字符串文本:
Hi
I
Am
a .Net Developer...
You may do like this.
你可以这样做。
var c = txtWords.Text.Replace(@"\n","");
or
或者
var c = txtWords.Text.Replace("\n","");

