I've used this function alot in my recent scripting systems. I find it usefull so I thought I'd just post it here.
function getPar(ntext$,check$,o$,c$)
text$=" "+open$+ntext$+close$
local brace as integer : brace=1
for t=1 to len(text$)
com$=mid(text$,t,len(check$))
if com$=check$
for c=(t+len(check$)+1) to len(text$)
cur$=mid$(text$,c)
if cur$=o$ then inc brace
if cur$=c$ then dec brace
ret$=ret$+cur$
if brace<=0
exit
endif
next c
endif
next t
ret$=left$(ret$,len(ret$)-1)
endfunction ret$
function mid(st$,p,ln)
l=ln-1
for s=p to p+l
new$=new$+mid$(st$,s)
next s
endfunction new$
There's also a 'mid' function which is uses. It's just like 'mid$' but for multiple letters.
So, if you have a line like this...
...the function would retrieve everything inside the brackets. But that's just a crappy example.
If you have this...
string$="blk1{ blk2{hello} blk3{world} }"
...you can call the function like this:
block$=getPar(string$,"blk2","{","}")
and blockk$ would be "hello". If you passed "blk3" to it, it would return "world". If you passed "blk1" to it, it would return "blk2{hello} blk3{world}"
Enjoy