优化了,测试字符串abcdefghijklmnopqrstu 21个字母
处理时间3秒到5秒左右
结果生成到 result.txt, 33MB 1048577 行 (第一行为空行)
2的20次方=1048576- if wscript.arguments.count=0 then
- createobject("wscript.shell").run _
- "cmd /c cscript " &chr(34) &wscript.scriptname &chr(34) & " isme"
- wscript.quit
- end if
- :rem paktc
-
- current=replace(wscript.scriptfullname,wscript.scriptname,"")
- '我获得当前路径的方法,很囧...
- set fs=createobject("scripting.filesystemobject")
- set result=fs.createtextfile(current &"result.txt")
-
- set inp=wscript.stdin
- set put=wscript.stdout
-
- 'src 定义整条字符串,不支持空格哦 <<- 定义在这里
- src="abcdefghijklmnopqrstu"
- srca=mid(src,1,10)
- srcb=mid(src,11)
-
- strall=""
- '先处理右边的参数示例"a","bcd"
- test mid(srcb,1,1),mid(srcb,2)
- put.writeline "Step 1 over. Step2:"
- '然后前面这部分的,每一个都连接之前的全部结果
- funcb mid(srca,1,1) ,mid(srca,2) &" "
- result.close
- inp.readline
-
- function test(strcho,strhave)
- if len(strhave)>0 then
- tmpstr=strcho &"." & left(strhave,1)
- test tmpstr,mid(strhave,2)
- tmpstr=strcho & left(strhave,1)
- test tmpstr,mid(strhave,2)
- else
- strall=strall &vbcrlf & strcho
- end if
- end function
-
- function funcb(strcho,strhave)
- strcho=replace(strcho," ","")
- if len(strhave)>0 then
- tmpstr=strcho &"." & left(strhave,1)
- funcb tmpstr,mid(strhave,2)
- tmpstr=strcho & left(strhave,1)
- funcb tmpstr,mid(strhave,2)
- else
- result.write replace(strall,vbcrlf,vbcrlf &strcho)
- put.writeline strcho
- end if
- end function
复制代码
|