如何除去文本中的回车符
文本文档内容:
Name = "EG"
Code = 0000434300003727438274827492832839 \
23782640000000
我想把“ \”和回车符去掉,变成:
Name = "EG"
Code = 000043430000372743827482749283283923782640000000
不知怎样才能实现呢?
[解决办法]
直接把Code变换从Varaint类型的变量。
[解决办法]
试试看,不保证对。
f=freefile()s=""open "a.txt" for input as #fdo Line input #f,ln if right(ln,2)=" \" then s=s+left(ln,len(ln)-2) else s=s+ln debug.printf s s="" endif if eof(f) then exit doloopclose #f
[解决办法]
Open App.Path & "\a.txt" For Input As #1
Open App.Path & "\a_new.txt" For Output As #2
Do Until EOF(1)
Line Input #1, strTmp1
If Right(strTmp1, 1) = "\" And Not EOF(1) Then
Line Input #1, strTmp2
strTmp1 = Left(strTmp1, Len(strTmp1) - 1) & strTmp2
End If
Print #2, strTmp1
Loop
Close #2
Close #1
Kill App.Path & "\a.txt"
Name App.Path & "\a_new.txt" As App.Path & "\a.txt"
[解决办法]
s=".................."'包含有回车换行的字串
s1=replace(s,vbcrlf,"") '将回车换行符号换为空字串
[解决办法]
replace(s,vbcr,"")
replace(s,vblf,"")
[解决办法]
replace(s,vbcr,"")
replace(s,vblf,"")
replace(s,"\","")
[解决办法]