Hi Charles...
I want try convert one expression evaluator from EB to Oxygen and i
find one problem in inverse function of INSTR called InstrP.
This function require one optional parameter.
Do we have in oxygen opt or optional statment ?
here is this function:
FUNCTION InstrP(source As STRING, search As STRING,start as INT) As INT
'this sub searches for the LAST string search in the string source,
'reverse of the function instr(). The sub returns 0 if the search could not be found.
'Also this function neglects content between brackets () in source
INT n, bopen,bclose
STRING sign
start=255
n=start
IF n > LEN(source) THEN n = LEN(source) - LEN(search)+1
bopen=0 'number of bracket open
bclose=0 'number of bracket close
DO
sign = MID(source, n, LEN(search))
IF sign=search AND bopen=bclose THEN RETURN n 'exit the sub, return n
IF LEFT(sign,1)=chr(28) THEN bopen++
IF LEFT(sign,1)=chr(29) THEN bclose++
n=n-1
IF n <= 0 THEN EXIT DO
END DO
RETURN 0 'if the string search is not found, then return 0
END FUNCTION
Or maybe i made mistake in DO loop ?
Any suggestion ?