已解决请教如何把112233转换成11:22:33用FOR
本帖最后由 fengzishao 于 2012-4-10 00:34 编辑For $i = 1 To 6 Step 2
$a=StringMid("112233",$i,2)
$a=$a&":"
MsgBox(0,"",$a)
Next
如何把得到值相边连起来。 msgbox(0, 0, stringleft($str, 2)& ':' & stringmid($str, 3,4) & ':' & stringright($string,2))
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Number = '112233'
msgbox(0, '_WinAPI_GetNumberFormat', _WinAPI_GetNumberFormat(0, $Number, _WinAPI_CreateNumberFormatInfo(0, 1, 2, '', ':', 1)))
Local $a, $str = '112233'
For $i = 1 To 3
$a &= StringLeft($str, 2) & ':'
$str = StringTrimLeft($str, 2)
Next
MsgBox(0, "", StringTrimRight($a, 1))
呵呵,群里刚回答过的。 http://www.autoitx.com/forum.php?mod=viewthread&tid=31484&highlight=%D7%AA%BB%BB
A 大 的代码, 学以致用:Local $Str = '112233'
Local $Test = StringRegExpReplace($str, '(\d\d)(\d\d)(\d\d)', '$1:$2:$3')
MsgBox(0, '替换结果', $Test) 谢谢各位楼上的朋友……哪么的热情 回复 4# user3000
不是这样不好,而是不知道lz的字符串是不是时间,如果只是时间,没问题,如果是个数字串,只是添加:来分割数字字符串,可能用正则写起来会很长
页:
[1]