求教关于连续赋值符号的问题[已解决]
本帖最后由 tsys 于 2012-1-14 19:53 编辑#include <Math.au3>
_Create_Fields("mdb","pwd","tbn","type","key","int","123","abc","text")
Func _Create_Fields($mdb_data_path,$mdb_data_pwd,$tblname,$type_1='',$key1='',$type_2='',$key2='',$type_3='',$key3='',$type_4='',$key4='', _
$type_5='',$key5='',$type_6='',$key6='',$type_7='',$key7='',$type_8='',$key8='',$type_9='',$key9='',$type_10='',$key10='')
Local $Value
If (@NumParams-5)/2 <> 0 And _MathCheckDiv(@NumParams-5, 2) = 2 Then
For $i = 2 To @NumParams-5
$Value &= ','&Eval('type_' & $i) &','&Eval('key' & $i)
Next
MsgBox(0,"",$Value)
EndIf
EndFunc以上代码运行结果如图:
请教如何将text 后面的2个逗号去掉,无论该函数有多少个参数,总是不希望最后一个值含有逗号。 回复 1# tsys
试试
StringTrimRight函数 MsgBox(0, "", StringRegExpReplace($Value, ',+\Z', '')) 额,A版正解,原来需要正则, StringTrimRight函数是不行的,如果我后面再加上2个参数,后面就会四个逗号的,问题解决,多谢A版
页:
[1]