Last updated 19 July 1999
This is very helpful when you want to write an XEDIT macro which allows additional arguments after a line target (like the PUT command does). Detecting the point in the argument where the target ends and the other arguments begin can be very tricky.
Example: Let's say you're writing FOO.REX and it's syntax is:
You would code the beginning of FOO.REX like so:
/* FOO.REX */ parse arg a /* The entire argument */ i = parset(a) /* Length of target */ t = left(a,i) /* The target */ r = substr(a,1+i) /* Everything else */ /* or: */ i = 1 + parset(a) /* 1 + Length of target */ parse var a t =(i) r /* Same t and r as above */ say 'Target = "' || t || '"' say 'Remain = "' || r || '"'
If you execute:
The following output will be produced:
Target = "/x/&~,/," Remain = "data txt"
You are visitor since 19 July 1999
Copyright © 1999 Rex Swain
E-mail email@example.com, Web http://www.rexswain.com
Permission granted to distribute unmodified copies