办法比较笨,不过测试附件能通过- strKey = "screen_key_long_press_timeout"
- with CreateObject("ADODB.Stream")
- .Type = 2
- .Mode = 3
- .CharSet = "utf-8"
- .Open
- .LoadFromFile "arrays.xml"
- ar = Split(.ReadText(-1),"</string-array>")
- For i = 0 to UBound(ar)
- If InStr(ar(i),strKey) Then ar(i) = RegEx(ar(i))
- Next
-
- .Position = 0
- .CharSet = "utf-8"
- .WriteText Join(ar,"</string-array>")
- .SetEOS
- .SaveToFile "a.xml",2
- .Close
- End with
-
- Function RegEx(str)
- Set re = New RegExp
- re.Pattern = "([\s\S]+?)([\d\.]+)|([\s\S]+)$"
- re.Global = true
- For Each m in re.Execute(str)
- If m.SubMatches(1) <> "" Then
- RegEx = RegEx & m.SubMatches(0) & m.SubMatches(1)/2
- Else RegEx = RegEx & m.SubMatches(2)
- End If
- Next
- End Function
复制代码
|