以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 怎样去掉换行符?【已解决】 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=108666) |
-- 作者:有点辣 -- 发布时间:2017/10/26 20:20:00 -- 怎样去掉换行符?【已解决】 见下图,想把文本框里的内容去掉换行符后,用竖线符号拼接 我写的代码是:
Dim tx As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim sts() As String = tx.value.split(vbcrlf)
Dim str As String
For Each st As String In sts
str = str & "|" & st.trim(vbcrlf)
Next
msgbox(str.trim("|")) 但出来不是想要的效果,希望是出来: 1|2|3
请问怎么改代码呢?
[此贴子已经被作者于2017/10/26 20:41:08编辑过]
|
-- 作者:有点甜 -- 发布时间:2017/10/26 20:32:00 --
[此贴子已经被作者于2017/10/26 20:33:03编辑过]
|
-- 作者:有点甜 -- 发布时间:2017/10/26 20:33:00 -- Dim tx As WinForm.TextBox = e.Form.Controls("TextBox1") Dim str As String = tx.text.Replace(vbcrlf, "|") msgbox(str) |
-- 作者:有点辣 -- 发布时间:2017/10/26 20:41:00 -- 以下是引用有点甜在2017/10/26 20:33:00的发言:
Dim tx As WinForm.TextBox = e.Form.Controls("TextBox1") Dim str As String = tx.text.Replace(vbcrlf, "|") msgbox(str)
简单粗暴,赞! |