Page 1 of 1

base:GetXMLHex()

Posted: Wed Apr 15, 2015 11:38 pm
by djrikki
Looking back at these old functions of mine, you can combine operability into one instead streamlined function simply providing a new 'pair' parameter and inserting that into the MidStr() and UnleftStr() lines instead of the existing absolute string definitions.

Code: Select all

Global base
base = {}

;; base:GetXmlHex(data,key)
; You should call this recursively in a While ... data = ReadLine(1)...Wend  structure; ex. call line$ = GetXmlHex(data,"Track Hex")
Function base:GetXmlHex(data,key)
    Local result = 0
    If FindStr(data,"<key>") > -1
        If FindStr(data,key) > -1
            data = ReadLine(1)
            result = MidStr(data,FindStr(data,"<hex>")+StrLen("<hex>"),StrLen(data))
            result = UnleftStr(result,StrLen("</hex>"))
        EndIf
    EndIf
    Return(result)
EndFunction