本帖最后由 foboy 于 2010-8-27 23:55 编辑
爷们也来段代码,是截止到此楼为止运行效率最高的。
在一般性能的笔记本上运行,10个字符的平均处理时间为50毫秒内,15个字符的处理时间为1秒左右。
试了一下20个字符,27秒。
在台式机上,10个字符的处理时间为21毫秒左右,15个字符的时间是660毫秒,20个符没测试。$aaa = "1234567890"
$string = StringRegExp($aaa, '\V', 3)
$string_num = UBound($string)
$result = ""
$pretime = TimerInit()
test($string, $string_num, 0, 0, "")
ConsoleWrite($result)
ConsoleWrite(TimerDiff($pretime))
Func test($_string, $_lenth, $_i, $_begin, $_sub_str)
For $i = $_i + StringLen($_sub_str) To $_lenth - 1
$_the_string = $_sub_str & $_string[$i]
$result &= $_the_string & @CRLF
test($_string, $_lenth, $_i, $i, $_the_string)
$_i += 1
Next
EndFunc ;==>test
|