标题: N多文件进行批量的固定长度回车并删掉空格的问题
[打印本页]
作者: zhengruijian
时间: 2008-6-1 12:48
标题: N多文件进行批量的固定长度回车并删掉空格的问题
跪求大侠,我实在是搞不定了.请你们帮忙啊!!!!多谢了!!!..
请大侠指点迷津!
我想对一个文件夹下的所有文件进行固定字符长度的回车.(30个汉字的长度)
在整理完长度后把里面的空格行全都删除掉.再保存,原文件名不变.
应该怎么做啊?
多谢啦!!!!!!!!!!!!
我只找到了下面这个程序只能执行一个文件,而且还不能保存.
@echo off
for /f "delims=" %%a in (yourtext.txt) do (
set var=%%a
setlocal enabledelayedexpansion
set var=!var: =!
if not "!var!"=="" set var=!var: =!
if not "!var!"=="" echo !var!
endlocal
)
pause
我要处理的范文如下 :
8、 I Apologize.
我很抱歉。
A: Jessie, I’m afraid I can’t come back home for dinner tonight.
杰茜,我恐怕今晚不能回家吃晚饭了。
B: Not back home for dinner again? That’s the third time this week!
又不回家吃晚饭?这个星期你已经是第三次了这样了!
A: I’m sorry. Our company has just opened. There are always too many things to handle. You know that.
对不起。我们的公司刚刚开业,总是有太多事情要处理,这你是知道的。
B: You don’t have to explain. Suit yourself.
你不必解释了。随便你。
A: I apologize. You have my word, I’ll spend some time with you on the weekend. I promise.
很抱歉。我向你保证,周末抽时间来陪你。我发誓。
B: We’ll see.
再说吧。
A: Thank you for understanding. I promise I’ll make it up to you.
谢谢你能理解。我保证一定给你补上。
A: Sam, you’ve got to forgive me.
山姆,你得原谅我。
B: Forgive you for what?
原谅你什么?
A: I used your computer. And I’m afraid I’ve erased your personal files accidentally.
我用了你的电脑。恐怕我不小心把你的私人文件删掉了。
B: No! Are you kidding me?
不!你跟我开玩笑?
A: I’m afraid not. I apologize.
不是。我很抱歉。
B: I can’t believe it! I have all my important personal documents stored in that computer. It’s no laughing matter.
我简直不敢相信!我将所有重要的私人资料都存入电脑了。这可不是闹着玩的。
A: I told you I’m sorry. What can I do to make it up to you?
我都跟你道歉了。我怎样做才能弥补我的过错?
B: Well, you should be sorry! Don’t ever use my computer again! You can’t do anything now, it’s too late!
你应该道歉!再也不许用我的电脑了!现在你做什么都没有用了,已经太迟了!
作者: slore
时间: 2008-6-1 14:26
findstr好像有空行过滤吧
作者: moniuming
时间: 2008-6-1 16:12
楼上有笔误吧,
for才过滤空行
@echo off
::放在要处理的目录里运行
::不能处理汉字(即无论汉字或英文, 超过60个才能处理)
::注意: 非空格行不能以空格开头
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /b/a-d "*.txt"') do (
type nul>temp.txt
for /f "delims=" %%m in ('type "%%i"') do (
set "str=%%m"
if "!str:~0,1!"==" " (set "str=!str: =!") else (call :cut)
)
move /y temp.txt "%%i"
)
goto :eof
:cut
set "var=%str:~0,60%"
>>temp.txt echo %var%
set str=%str:~60%
if not "%str%"=="" goto :cut
作者: clonecd
时间: 2008-6-1 16:55
标题说删除空格,文章里面说删除空格行,一开始还真不知道是什么意思。
[
Last edited by clonecd on 2008-6-1 at 04:57 PM ]
作者: terse
时间: 2008-6-1 17:08
因为有中英文 我是这样处理的:
汗我以为要删空格 改吧
@echo off
for /f "delims=" %%i in ('dir /b /a-d *.txt') do (
for /f "delims=" %%a in ('more "%%i"') do (
set var=%%a
setlocal enabledelayedexpansion
call :lp
endlocal
)
move /y temp_.txt "%%i"
)
pause&goto :eof
:lp
if not defined var goto :eof
if "%var:~,1%"==" " set var=%var:~1%&goto lp
if "%var:~,1%"==" " set var=%var:~1%&goto lp
if "%var:~,1%" gtr "Z" (
:lp1
if defined var >>temp_.txt echo %var:~,30%&set var=%var:~30%&goto lp1
goto :eof
) else (
:lp2
if defined var (>>temp_.txt echo !var:~,60!&set var=%var:~60%&goto lp2))
[
Last edited by terse on 2008-6-1 at 05:50 PM ]
作者: moniuming
时间: 2008-6-1 19:54
to:5楼
运行结果:
把最后一个括号去掉后没有提示,直接退出.
Quote: |
E:\games\test>1
E:\games\test>for /F "delims=" %i in ('dir /b /a-d *.txt') do (
for /F "delims=" %a in ('more "%i"') do (
set var=%a
setlocal enabledelayedexpansion
call :lp
endlocal
)
move /y temp_.txt "%i"
)
E:\games\test>(
for /F "delims=" %a in ('more "1.txt"') do (
set var=%a
setlocal enabledelayedexpansion
call :lp
endlocal
)
move /y temp_.txt "1.txt"
)
E:\games\test>(
set var=B: We’ll see.
setlocal enabledelayedexpansion
call :lp
endlocal
)
E:\games\test>if not defined var goto :eof
E:\games\test>if "B" == " " set var=: We’ll see. & goto lp
E:\games\test>if "B" == " " set var=: We’ll see. & goto lp
E:\games\test>
E:\games\test> |
|
[
Last edited by moniuming on 2008-6-1 at 07:55 PM ]
作者: slore
时间: 2008-6-1 20:49
标题: =。=我没有打错。。。
@echo off
findstr "." Slore.txt>erolS.txt
::下面的空格数你自己可以多打点,按你的格式
::来看连续这么多空格应该够了。
findstr /v /c:" " erolS.txt>Slore.txt
echo 处理完毕!
pause>nul
[
Last edited by slore on 2008-6-1 at 08:55 PM ]
作者: zhengruijian
时间: 2008-6-1 20:56
谢谢各位大哥的帮助.
用了达人的这个代码处理得很好,只是不能处理汉字,英文倒是排得好好的.不知道怎么样能做成处理汉字的?就是说30个汉字的长度也换行.下面的代码该如何改善一下才能做到呢?
@echo off
::放在要处理的目录里运行
::不能处理汉字(即无论汉字或英文, 超过60个才能处理)
::注意: 非空格行不能以空格开头
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /b/a-d "*.txt"') do (
type nul>temp.txt
for /f "delims=" %%m in ('type "%%i"') do (
set "str=%%m"
if "!str:~0,1!"==" " (set "str=!str: =!") else (call :cut)
)
move /y temp.txt "%%i"
)
goto :eof
:cut
set "var=%str:~0,60%"
>>temp.txt echo %var%
set str=%str:~60%
if not "%str%"=="" goto :cut
我用上面这个程序把范文处理后是这样的:
8、 I Apologize.
我很抱歉。
A: Jessie, I’m afraid I can’t come back home for dinner toni
ght.
杰茜,我恐怕今晚不能回家吃晚饭了。
B: Not back home for dinner again? That’s the third time thi
s week
又不回家吃晚饭?这个星期你已经是第三次了这样了!
A: I’m sorry. Our company has just opened. There are always
too many things to handle. You know that.
对不起。我们的公司刚刚开业,总是有太多事情要处理,这你是知道的。
B: You don’t have to explain. Suit yourself.
你不必解释了。随便你。
A: I apologize. You have my word, I’ll spend some time with
you on the weekend. I promise.
很抱歉。我向你保证,周末抽时间来陪你。我发誓。
B: We’ll see.
再说吧。
A: Thank you for understanding. I promise I’ll make it up to
you.
谢谢你能理解。我保证一定给你补上。
A: Sam, you’ve got to forgive me.
山姆,你得原谅我。
B: Forgive you for what?
原谅你什么?
A: I used your computer. And I’m afraid I’ve erased your per
sonal files accidentally.
我用了你的电脑。恐怕我不小心把你的私人文件删掉了。
B: No Are you kidding me?
不!你跟我开玩笑?
A: I’m afraid not. I apologize.
不是。我很抱歉。
B: I can’t believe it I have all my important personal docum
ents stored in that computer. It’s no laughing matter.
我简直不敢相信!我将所有重要的私人资料都存入电脑了。这可不是闹着玩的。
A: I told you I’m sorry. What can I do to make it up to you?
我都跟你道歉了。我怎样做才能弥补我的过错?
B: Well, you should be sorry You can’t do anything now, it’s
too late
你应该道歉!再也不许用我的电脑了!现在你做什么都没有用了,已经太迟了!
作者: slore
时间: 2008-6-1 21:00
。。。原来是这个意思。。。一个汉字算2个字节还是要怎么样呀?
作者: zhengruijian
时间: 2008-6-1 21:12
@echo off
::放在要处理的目录里运行
::不能处理汉字(即无论汉字或英文, 超过60个才能处理)
::注意: 非空格行不能以空格开头
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('dir /b/a-d "*.txt"') do (
type nul>temp.txt
for /f "delims=" %%m in ('type "%%i"') do (
set "str=%%m"
if "!str:~0,1!"==" " (set "str=!str: =!") else (call :cut)
)
move /y temp.txt "%%i"
)
goto :eof
:cut
set "var=%str:~0,30%"
>>temp.txt echo %var%
set str=%str:~30%
if not "%str%"=="" goto :cut
这个程序扩展性不错啊.我把里面的60全改为30后,处理成如下这个样子,可是英文看起来是真的很不爽啊.一句话搞成了好几行.
我想好好排下版的目的就是把这些文本做成LRC的歌词格式.我有配套的MP3.如果做好了哪位兄弟要的话,我可以传给你们啊.大家相互帮忙一下啊!
哪位大哥能把这个程序改善下啊.就是排版出来都是30个汉字长度才回车.那样大家都看得舒服些.
8、 I Apologize.
我很抱歉。
A: Jessie, I’m afraid I can’t
come back home for dinner toni
ght.
杰茜,我恐怕今晚不能回家吃晚饭了。
B: Not back home for dinner ag
ain? That’s the third time thi
s week
又不回家吃晚饭?这个星期你已经是第三次了这样了!
A: I’m sorry. Our company has
just opened. There are always
too many things to handle. You
know that.
对不起。我们的公司刚刚开业,总是有太多事情要处理,这你是知道
的。
B: You don’t have to explain.
Suit yourself.
你不必解释了。随便你。
A: I apologize. You have my wo
rd, I’ll spend some time with
you on the weekend. I promise.
很抱歉。我向你保证,周末抽时间来陪你。我发誓。
B: We’ll see.
再说吧。
A: Thank you for understanding
. I promise I’ll make it up to
谢谢你能理解。我保证一定给你补上。
A: Sam, you’ve got to forgive
me.
山姆,你得原谅我。
B: Forgive you for what?
原谅你什么?
A: I used your computer. And I
’m afraid I’ve erased your per
sonal files accidentally.
我用了你的电脑。恐怕我不小心把你的私人文件删掉了。
B: No Are you kidding me?
不!你跟我开玩笑?
A: I’m afraid not. I apologize
.
不是。我很抱歉。
B: I can’t believe it I have a
ll my important personal docum
ents stored in that computer.
It’s no laughing matter.
我简直不敢相信!我将所有重要的私人资料都存入电脑了。这可不是
闹着玩的。
A: I told you I’m sorry. What
can I do to make it up to you?
我都跟你道歉了。我怎样做才能弥补我的过错?
B: Well, you should be sorry Y
ou can’t do anything now, it’s
你应该道歉!再也不许用我的电脑了!现在你做什么都没有用了,已
经太迟了!
作者: zhengruijian
时间: 2008-6-1 21:14
忘了说了,上面的范文是疯狂英语里面的一篇..希望大家帮忙,我想学好英语.
[
Last edited by zhengruijian on 2008-6-1 at 09:21 PM ]
作者: terse
时间: 2008-6-1 22:09
Quote: |
Originally posted by moniuming at 2008-6-1 19:54:
to:5楼
运行结果:
把最后一个括号去掉后没有提示,直接退出.
[ Last edited by moniuming on 2008-6-1 at 07:55 PM ] |
|
怎么回事 我这里可以的嘛
下面是处理后的:
8、 I Apologize.
我很抱歉。
A: Jessie, I’m afraid I can’t come back home for dinner tonight.
杰茜,我恐怕今晚不能回家吃晚饭了。
B: Not back home for dinner again? That’s the third time this week!
又不回家吃晚饭?这个星期你已经是第三次了这样了!
A: I’m sorry. Our company has just opened. There are always too many things to handle. You know that.
对不起。我们的公司刚刚开业,总是有太多事情要处理,这你是知道的。
B: You don’t have to explain. Suit yourself.
你不必解释了。随便你。
A: I apologize. You have my word, I’ll spend some time with you on the weekend. I promise.
很抱歉。我向你保证,周末抽时间来陪你。我发誓。
B: We’ll see.
再说吧。
A: Thank you for understanding. I promise I’ll make it up to you.
谢谢你能理解。我保证一定给你补上。
A: Sam, you’ve got to forgive me.
山姆,你得原谅我。
B: Forgive you for what?
原谅你什么?
A: I used your computer. And I’m afraid I’ve erased your personal files accidentally.
我用了你的电脑。恐怕我不小心把你的私人文件删掉了。
B: No! Are you kidding me?
不!你跟我开玩笑?
A: I’m afraid not. I apologize.
不是。我很抱歉。
B: I can’t believe it! I have all my important personal documents stored in that computer. It’s no laughing matter.
我简直不敢相信!我将所有重要的私人资料都存入电脑了。这可不是闹着玩的。
A: I told you I’m sorry. What can I do to make it up to you?
我都跟你道歉了。我怎样做才能弥补我的过错?
B: Well, you should be sorry! Don’t ever use my computer again! You can’t do anything now, it’s too late!
你应该道歉!再也不许用我的电脑了!现在你做什么都没有用了,已经太迟了!
作者: slore
时间: 2008-6-1 22:15
?貌似没有除了的样子呀=。=
作者: moniuming
时间: 2008-6-1 22:28
弄得我头都大了(借用5楼的判断方法



),这次应该没问题了,汗.........
@echo off
for /f "delims=" %%i in ('dir /b/a-d "*.txt"') do (
type nul>temp.txt
for /f "delims=" %%m in ('type "%%i"') do (
set "str=%%m"
call :cut
)
move /y temp.txt "%%i"
)
pause&goto :eof
:cut
if "%str:~,1%"==" " (
if not "%str:~1%"=="" (
set "str=%str:~1%"&goto :cut
) else (
goto :eof
)
)
if "%str:~,1%"==" " (
if not "%str:~1%"=="" (
set "str=%str:~1%"&goto :cut
) else (
goto :eof
)
)
if "%str:~,1%" gtr "Z" (
:cut1
>>temp.txt echo %str:~,30%
if not "%str:~30%"=="" (
set "str=%str:~30%"&goto :cut1
) else (
goto :eof
)
) else (
:cut2
>>temp.txt echo %str:~,60%
if not "%str:~60%"=="" (
set "str=%str:~60%"&goto :cut2
) else (
goto :eof
)
)
作者: terse
时间: 2008-6-1 22:33
我刚才 发出来怎么这样啊 这样呢
8、 I Apologize.
我很抱歉。
A: Jessie, I’m afraid I can’t come back home for dinner toni
ght.
杰茜,我恐怕今晚不能回家吃晚饭了。
B: Not back home for dinner again? That’s the third time thi
s week
又不回家吃晚饭?这个星期你已经是第三次了这样了!
A: I’m sorry. Our company has just opened. There are always
too many things to handle. You know that.
对不起。我们的公司刚刚开业,总是有太多事情要处理,这你是知道
的。
B: You don’t have to explain. Suit yourself.
你不必解释了。随便你。
A: I apologize. You have my word, I’ll spend some time with
you on the weekend. I promise.
很抱歉。我向你保证,周末抽时间来陪你。我发誓。
B: We’ll see.
再说吧。
A: Thank you for understanding. I promise I’ll make it up to
you.
谢谢你能理解。我保证一定给你补上。
A: Sam, you’ve got to forgive me.
山姆,你得原谅我。
B: Forgive you for what?
原谅你什么?
A: I used your computer. And I’m afraid I’ve erased your per
sonal files accidentally.
我用了你的电脑。恐怕我不小心把你的私人文件删掉了。
B: No! Are you kidding me?
不!你跟我开玩笑?
A: I’m afraid not. I apologize.
不是。我很抱歉。
B: I can’t believe it! I have all my important personal docu
ments stored in that computer. It’s no laughing matter.
我简直不敢相信!我将所有重要的私人资料都存入电脑了。这可不是
闹着玩的。
A: I told you I’m sorry. What can I do to make it up to you?
我都跟你道歉了。我怎样做才能弥补我的过错?
B: Well, you should be sorry! Don’t ever use my computer aga
in
作者: terse
时间: 2008-6-1 22:43
Quote: |
Originally posted by slore at 2008-6-1 22:15:
?貌似没有除了的样子呀=。= |
|
我在本地测试是好的发上来就这样的格式
作者: 26933062
时间: 2008-6-1 22:48
看楼主的意思好像是 以60个字节来分割行,这个问题用批来作,即使作出来效率都是不敢恭维的。
况且 用 判断是否大于 Z 的方法,好像也无法对所有字符进行准确判断。
作者: terse
时间: 2008-6-1 23:08
Quote: |
Originally posted by 26933062 at 2008-6-1 22:48:
看楼主的意思好像是 以60个字节来分割行,这个问题用批来作,即使作出来效率都是不敢恭维的。
况且 用 判断是否大于 Z 的方法,好像也无法对所有字符进行准确判断。 |
|
确实是的 我开始写了一个逐字处理的 但效率不怎么样 因为看楼主的范本就是两行相隔的 故。。。
[
Last edited by terse on 2008-6-1 at 11:10 PM ]
作者: slore
时间: 2008-6-1 23:15
VBS的话……
作者: zhengruijian
时间: 2008-6-2 06:10
Quote: |
Originally posted by moniuming at 2008-6-1 22:28:
弄得我头都大了(借用5楼的判断方法:):P:)),这次应该没问题了,汗.........
[code]@echo off
for /f "delims=" %%i in ('dir /b/a-d "*.txt"') do (
type nul&g ... |
|
我用14楼的这段代码处理了一下之后,有的文章变成这样的了.个别的句子没有处理.可能是程序不够完善吧.
PART 3:INTERMEDIATE DIALOGUES
中级对话
如果你把前一部分最基本的初级对话都掌握了的话,那就开始下一步
的跋涉——进军中级对话吧。具有中级英语水平的人,也就具备了中
级交流的能力。这一部分的对话涉及生活、工作和学习的点点滴滴,
有发生在老朋友之间的,有同学之间、亲友之间的,有发生在同事之
间的,也有上下级之间的。但不论场景如何变化,它们的共同点就是
――交流。
1. I Can’t Believe My Eyes
我简直不能相信眼前的事实
A: I can’t believe my eyes!
我简直不能相信眼前的事实!
B: Well, if it isn’t Mike Li!
这不是迈克·李吗!
A: Jim Wang! It’s nice to see you again! It’s been a long ti
me.
吉姆·王!见到你真是太高兴了!好久不见了。
B: You know, Mike, I’ve been meaning to call you for a long
time. I’m so glad I ran into you today.
迈克,你知道吗,很久以来我一直想给你打电话。真高兴今天能遇到
你。
A: Me, too. How have you been doing?
我也一样。你最近好吗?
B: Super. How about yourself?
很好。你呢?
A: Pretty good. I can’t complain.
不错,没什么可抱怨的。
B: So tell me, the last time I saw you, you were planning to
go abroad to study, weren’t you?
快说来听听,我上一次见到你的时候,你正准备去出国留学呢,是不
是?
A: Yes, I guess I was. But as it turned out, I changed my mi
nd. I decided not to go after all.
是,我想是的。但现在有了变化,我最终还是决定不去了。
B: Oh, really? But if I remember correctly, you were intent
on going to California. Whatever made you change your mind?
I thought you were accepted to Stanford.
哦,是吗?如果我没记错的话,你当时是要去加利福尼亚。是什么使
你改变主意的?我记得你是被斯坦福大学录取了。
A: Well, it’s a long story, and I don’t want to bore you wit
h all the details. But what it boils down to is that I decid
ed that going to Stanford wasn’t a very good idea. I decided
to go to Beijing University instead. I want to save my mone
y and start my own business after graduation.
说来话长。那些细节我就不赘述了。最后的结果是,我觉得去斯坦福
读书不太明智。我打算去北大。这样,把钱省下来,毕业后可以自己
开一家公司。
B: Really? That’s very interesting.
是吗?那很有趣嘛。
A: And how about you? The last time we talked, didn’t you te
ll me you were going to open your own restaurant and hotel?
你怎么样?上次我们聊的时候,你不是说要自己开个酒店吗?
B: That’s right. I was. But things turned out differently th
an I expected.
对呀,是有这么回事。但结果却和我预想的大不相同。
A: But you seemed so determined to do that. What happened?
可是你当时是决心很大的,发生了什么事呢?
B: Well, it’s very complicated, and I’m sure you don’t want
to know all the details. But as it turned out, I decided tha
t opening my restaurant just wasn’t for me. So I decided to
stay at my old job instead.
说来复杂。我知道你不愿意听详细的个中原由。但结果却是,我觉得
自己开饭店并不适合我,所以就决定留在原来的工作岗位。
A: Well, a lot sure has happened since we last saw each othe
r.
是啊,从上次见面以来,真是发生了很多事。
B: You can say that again! You know, we should try to stay i
n touch.
你说得对!我们应该尽量保持联系。
A: Yes, we should. Let’s have lunch together sometime soon.
的确应该如此。我们最近找时间吃个午饭吧。
B: That’s a good idea. I’ll call you.
这主意不错。我到时候给你打电话。
A: OK. Take care now.
好吧。多保重。
B: You, too.
你也是。
口语要素
大家会发现,对话里面出现最多的是精彩的“口语要素”,其实,日
常对话都是这些零零碎碎的“口语要素”组成的!一部英文电影又何
尝不是成千上万“口语要素”的集合呢!
★ I can’t believe my eyes! 我简直不能相信眼前的事实!
举一反三:
* I can’t believe my ears! 真是让人难以置信!
* I can’t believe what I saw! 我不相信我的眼睛!
★ It’s nice to see you again! 又见到你真是太高兴了!
★ It’s been a long time. 好久不见了。
★ I’m so glad I ran into you today. 真高兴今天能遇到你。
★ How have you been doing? 你最近好吗?
★ How about yourself? 你呢?过得好吗?
★ Pretty good./ Super. / I can’t complain. 很好。/棒极了。/没什么可抱怨的。
【经典回答】
★ I changed my mind. 我改变了主意。
★ I decided not to go after all. 我最终还是决定不去了。
★ Whatever made you change your mind? 是什么使你改变主意的?
It’s a long story. 说来话长。
You can say that again! 你说得对!
举一反三:
* You said it! 你说对了!
* I’ll say! 你说得对!
* You’re right! 你说得对!
★ I don’t want to bore you with all the details. 那些细节我就不赘述了。
★ I decided to go to Beijing University instead. 我最后决定去北大读书。
★ Really? 是吗?
★ That’s very interesting. 那很有趣嘛。
And how about you? 你怎么样?
★ What happened? 发生了什么事呢?
★ We should try to stay in touch. 我们应该尽量保持联系。
举一反三:
* We should keep in touch. 我们应该保持联系。
* We should contact each other more often. 我们应该多多联系。
* We should keep each other informed. 我们应该保持联系。
* We should get together more often. 我们应该多多联系。
Let’s have lunch together sometime soon. 我们最近找时间吃个午饭吧。
【疯狂提示】
这是一个典型的结束此类谈话的方式。如果有一个外国人到谈话的末
尾对你说出这句话,要谨记两点:第一,不要追问确切的“一起吃午
饭”的时间,第二,不要苦苦地等待那顿“不花钱的午餐”。如果对
方出于诚意,他会这样说:Let’s have lunch t
ogether next Monday, OK?
That’s a good idea. 这主意不错。
★ I’ll call you. 我到时候给你打电话。
★ Take care now. 多保重。
超级短语
run into 碰到,遇到,邂逅
turn out 结果
after all 最终;毕竟
be intent on 决心要做;对某事专心致志
boil down to 等于;归结为
a lot sure has happened 变化很大
stay in touch 保持联系
超级句型:
① Well, if it isn’t somebody! 哟,这不是某某某吗!
Well, if it isn’t Mike Li!
这不是迈克·李吗!
【疯狂提示】这是一个引起谈话的重要句型,也是扯闲话的经典开端!
② What it boils down to 简单说来
What it boils down to is that I decided that going to Stanfo
rd wasn’t a very good idea.
简单说来,我觉得去斯坦福读书不太明智。
举一反三:
* The matter of fact is that going to Stanford wasn’t a very
good idea.
事实是,我觉得去斯坦福读书不太明智。
* As it turned out, going to Stanford wasn’t a very good ide
a.
最后的结果是,我觉得去斯坦福读书不太明智。
③ I’ve been meaning to 很久以来我一直想……
I’ve been meaning to call you for a long time.
很久以来我一直想给你打电话。
【疯狂提示】这是一个掩盖粗心、健忘及忙昏了头等等过失的最好的遮羞布!这是一个既体贴又体面但又不失虚伪的句型。一定要掌握它
!
作者: zhengruijian
时间: 2008-6-2 06:17
Quote: |
Originally posted by terse at 2008-6-1 23:08:
确实是的 我开始写了一个逐字处理的 但效率不怎么样 因为看楼主的范本就是两行相隔的 故。。。
[ Last edited by terse on 2008-6-1 at 11:10 PM ] |
|
您说得对,MS对这样"【"的字符处理不了.
标准的30个汉字的长度不就是60个字节吧.,不难理解啊.就是无论英文还是中文,都是60个字节回车.
我的文章不多,就60多篇,总共6M左右.不算大.
作者: moniuming
时间: 2008-6-2 09:43
Quote: |
我用14楼的这段代码处理了一下之后,有的文章变成这样的了.个别的句子没有处理.可能是程序不够完善吧. |
|
14楼的代码是以每行的第一个字符来进行判断的,只能处理纯英文或纯中文的行,如果要按60个字节来处理的话,只能求助于VBS高手了,
slore该出手了吧
作者: slore
时间: 2008-6-2 14:01
Const ForReading
= 1
Const ForWriting
= 2
FileName
= "
test.txt"
Set objFSO
= CreateObject("
Scripting.FileSystemObject"
)
Set objFile
= objFSO.
OpenTextFile(FileName, ForReading
)
Do Until objFile.AtEndOfStream
StrLine
= objFile.
ReadLine
If Len(StrLine
) Then '如果不是空行
If Len(Replace(StrLine," ",""
)) Then '如果不是纯空格行
OutLine
= CutStrB
(StrLine,60
)
OutStr
= OutStr
& OutLine
& vbCrLf
End If
End If
Loop
Set objFile
= objFSO.
OpenTextFile(FileName, ForWriting,
True)
objFile.Write
Replace(OutStr,
vbCrLf & vbCrLf,vbCrLf)
objFile.
Close
Function CutStrB
(StrExp,BinLen
)
Dim i,C,AC
For i
= 1
To Len(StrExp
)
C
= Mid(StrExp, i, 1
):AC
= Asc(C
)
If Not (AC
>= 0
And AC
< 128
) Then MixLen
= MixLen
+ 1
MixLen
= MixLen
+ 1
CutStrB
= CutStrB
& C
If MixLen
>= BinLen
Then MixLen
= 0:CutStrB
= CutStrB
& vbCrLf
Next
End Function
作者: zhengruijian
时间: 2008-6-3 02:02
Quote: |
Originally posted by slore at 2008-6-2 14:01:
Const ForReading = 1
Const ForWriting = 2
FileName = "test ... |
|
这段程序怎么用的,我把它保存成.bat或者.cmd之后运行都不行呢,一闪而过,再查看文件夹里的文件,一个都没变.
我是把它保存在文件所在文件夹里运行的.不知道对不对?
作者: bat-zw
时间: 2008-6-3 08:08
晕,要保存成vbs。
ps:无语。。。
作者: zhengruijian
时间: 2008-6-3 15:42
Quote: |
Originally posted by zw19750516 at 2008-6-3 08:08:
晕,要保存成vbs。
ps:无语。。。 |
|
我保存成VBS的运行后,提示我这个呢.怎么回事.
