This must have a simple answer but I cannot find where the problem is:
The parser function should return the values seperately exactly as they are in the string but instead it gives vastly inflated values. WTF?
The parse function is from the code archieves:
Test code:
Parse Function
Anyone? It must be something simple...
Darkheart
The parser function should return the values seperately exactly as they are in the string but instead it gives vastly inflated values. WTF?
The parse function is from the code archieves:
Test code:
Graphics3D 800,600,32,2 SetBuffer BackBuffer() Include "parse.bb" SD$="-7.039824 0.000000 -12.134317 7.039824 0.000004 -12.134317 -7.039824 0.000000 12.134317 7.039824 0.000004 12.134317" Dim PARSERRETURN$(1) count=parser$(SD$) For i=1 To count myval#=parserreturn$(i) Print myval# Next
Parse Function
Function parser$(txt$) occurence = occurence(txt$," ") Dim parserreturn(occurence+1) For a = 1 To occurence Repeat b = b + 1 If Mid$(txt$, b, 1) <> " " c = c + Mid$(txt$, b, 1) Else endloop = 1 parserreturn(a) = c EndIf Until endloop = 1 endloop = 0 c = 0 Next b = b + 1 parserreturn(occurence+1) = Mid$(txt$, b) Return occurence+1 End Function ;simple occurence function, it finds all instances of one string in another ;txt$ is the string to find stuff in and txt2$ is the string to find in txt$ ;example: ;z = occurence("doremesofadole", "e") ;print z ;(and I dont know what the REAL music notes are :P) Function occurence(txt$, txt2$) offset = 1 occur = 0 Repeat If Instr(txt$, txt2$, offset) > 0 offset = Instr(txt$, txt2$, offset) + 1 occur = occur + 1 Else endloop = 1 EndIf Until endloop = 1 Return occur End Function
Anyone? It must be something simple...
Darkheart