您的位置:程序门 -> vb -> 基础类



将一段文字,当遇到规定标志时自动换行


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


将一段文字,当遇到规定标志时自动换行[已结贴,结贴人:shaori]
发表于:2007-06-12 01:38:50 楼主
打开txt文件,然后一段:
http://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e9%97%9fhttp://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e99fhttp://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e9fhttp://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e9%97%ae%e9%a2%98%ef%bc%

没有分行,如何读取这段代码,然后每当有 "http:// "的时候就自动回车,变成这个样子,然后close

http://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e9%97%9f
http://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e99f
http://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e9f
http://community.csdn.net/indexpage/newtopic.aspx?key=%e8%be%93%e5%85%a5%e9%97%ae%e9%a2%98%ef%bc%

感谢
发表于:2007-06-12 01:51:191楼 得分:4
replace(str,   "http:// ",chr(13)   &   "http:// ")
发表于:2007-06-12 12:59:122楼 得分:0
先谢谢大大的方法~~
但是不知为什么,我生成的那个txt文件只是显示为这样
http://img3.glowfoto.com/images/2007/06/11-2142238117t.gif

没有回车

help~~~
我是这样写的,请教....
==================================================
dim   filenum   as   integer,   tempstr   as   string

tempstr   =   richtextbox1.text
tempstr   =   replace(tempstr,   "http:// ",   chr(13)   &   "http:// ")

filenum   =   freefile

open   text1.text   &   "\ "   &   test1.text   &   ".txt "   for   output   as   filenum
print   #filenum,   tempstr
close
发表于:2007-06-12 13:00:513楼 得分:0
图片显示地址
http://www.glowfoto.com/viewimage.php?img=11-214443l&y=2007&m=06&t=gif&rand=3111&srv=img3
发表于:2007-06-12 13:33:284楼 得分:5
tempstr   =   replace(tempstr,   "http:// ",   vbcrlf   &   "http:// ")
发表于:2007-06-12 13:38:275楼 得分:5
dim   filenum   as   integer,   tempstr   as   string

        tempstr   =   richtextbox1.text
        tempstr   =   replace(tempstr,   "http:// ",   chr(13)   &   "http:// ")

        filenum   =   freefile

open   app.path   &   "test1.text "   for   output   as   filenum

        print   #filenum,   tempstr

close   #filenum


这样写可以的啊
发表于:2007-06-12 17:02:496楼 得分:4
try:
1.tempstr   =   replace(tempstr,   "http:// ",   chr(10)   &   chr(13)   &   "http:// ")
2.tempstr   =   replace(tempstr,   "http:// ",   chr(13)   &   chr(13)   &   "http:// ")
3.tempstr   =   replace(tempstr,   "http:// ",   vbcrlf   &   "http:// ")
4.tempstr   =   replace(tempstr,   "http:// ",   vbcrlf     &   vbcrlf   &   "http:// ")
发表于:2007-06-12 19:06:077楼 得分:0
我的问题是,如图

http://www.glowfoto.com/viewimage.php?img=11-214443l&y=2007&m=06&t=gif&rand=3111&srv=img3

生成的txt文件中并没有换行的说!!!

我想生成的txt文件有换行
发表于:2007-06-12 19:09:498楼 得分:5
你要在txt中换行
那么可以用fso.writeline来,每行写入

你如何写入到txt中的呢?你分行写入就好
发表于:2007-06-18 20:36:599楼 得分:0
还是不行呢~~~~

能不能讲解详细点???

如果是一段段的话,那个写来写去都是第一行了
发表于:2007-06-25 01:31:2510楼 得分:5
try:

dim   filenum   as   integer,   tempstr   as   string

        tempstr   =   richtextbox1.text
        tempstr   =   replace(tempstr,   "http:// ",   vbcrlf   &   "http:// ")

        filenum   =   freefile

open   app.path   &   "test1.text "   for   binary   as   filenum

        put   #filenum,,   tempstr

close   #filenum


快速检索

最新资讯
热门点击