ini比较多个关键字,显示不相同的字串,請帮帮我[已解决]
本帖最后由 ticket 于 2015-9-7 11:11 编辑各个请帮帮我~~~,谢谢~{:face (229):}
找文和测试都没成功
要如何编写!!
myfile.ini的内容:
00-1E-8C-10-F6-7F=ON
00-22-AA-C9-5B-26=ON
00-08-9B-BE-33-A9=ON
00-40-01-30-B5-DD=ON
00-1E-8C-10-F6-7F=ON
00-22-AA-C9-5B-26=ON
00-40-01-30-B5-DD=ON比较后结果是:
00-08-9B-BE-33-A9=ON
如下的思路对吗?
A1比较
A2比较
A3比较
A4比较
$MAC=IniReadSection(@ScriptDir & "\myfile.ini","mac" )
$game1= $MAC
While 1
$MAC1=IniReadSection(@ScriptDir & "\myfile.ini","mac1" )
For $x=1 To $MAC1
$game2= $MAC1[$x]
;MsgBox(0,"",$MAC1[$x])
Dim $_tmp=StringSplit($game2,"")
For $x=1 To $_tmp
If $_tmp[$x]="" Then ContinueLoop
$game1a=StringReplace($game1,$_tmp[$x],"")
Next
MsgBox(0,"",$game1a)
Next
WEnd 应该是找出具有“唯一性”的关键字行吧,所以干脆每行关键字都比较一下才对。Local $sRe = ''
Local $Ini = @ScriptDir & "\myfile.ini"
Local $sText = FileRead($Ini)
_get_ini_unique_str()
MsgBox(0, '', $sRe)
Func _get_ini_unique_str()
Local $sSN = 'mac'
Local $iC = 0
While 1
Local $MAC=IniReadSection($Ini,$sSN)
If @error Then ExitLoop
For $i = 1 To $MAC
Local $sTmp = $MAC[$i] & '=' & $MAC[$i]
StringReplace($sText, $sTmp, '')
If @extended < 2 Then $sRe &= $sTmp & @CRLF
Next
$iC += 1
$sSN &= $iC
WEnd
EndFunc 本帖最后由 ticket 于 2015-9-7 11:21 编辑
可以了,谢谢你的指敎,没想到也可以用这种方式
Local $sTmp = $MAC[$i] & '=' & $MAC[$i]
StringReplace($sText, $sTmp, '')
学到了,{:face (293):}
页:
[1]