本帖最后由 rolaka 于 2010-3-15 21:47 编辑 $number = 1200000
$array = StringSplit($number, "", 2)
$string = ""
For $i = 0 To UBound($array)-1
For $n = 1 To $array[$i]
$string &= "."
Next
Next
If StringRegExp($string, '^(...)+$') Then
MsgBox(0, 0, $number & ' 是3的倍数')
Else
MsgBox(0, 0, $string & ' 不是3的倍数')
EndIf
山寨升级版.................................(afan的 1200000会出错...)
T_T 正则本身不支持运算 好郁闷
极限测试$time = TimerInit()
$number = 999999999999999999
$array = StringSplit($number, "", 2)
$string = ""
For $i = 0 To UBound($array)-1
For $n = 1 To $array[$i]
$string &= "."
Next
Next
If StringRegExp($string, '^(...)+$') Then
MsgBox(0, TimerDiff($time), $number & ' 是3的倍数')
Else
MsgBox(0, TimerDiff($time), $string & ' 不是3的倍数')
EndIf
|