是否可以将从文本框中获取的一段文本变成连续的一行?
我可能会有以下信息:
34 MyRoad
da7 888
london
the moon
And I want it to read :
34 MyRoad da7 888 london the moon
感谢您的提前帮助。编辑:添加空格以引起换行,并将样本数据格式化为代码。
是否可以将从文本框中获取的一段文本变成连续的一行?
我可能会有以下信息:
34 MyRoad
da7 888
london
the moon
And I want it to read :
34 MyRoad da7 888 london the moon
Dim FullAddress as String = TextBox1.Text.Replace(vbCrLf," ")
Split-Join
来处理原始字符串:Dim lines = multiLineText.Split({Environment.NewLine}, StringSplitOptions.None)
Dim oneLineText = String.Join(" ", lines)
Edit: 当然,如Derek所建议的,一个简单的String.Replace也能做到这个任务。
oneLineText = multiLineText.Replace(Environment.NewLine, " ")