[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Parsing of GetPath



Reply to note from Patricia M Godfrey  Fri, 24
Sep 2004 18:49:09 -0400

Patricia:

> It seems that I CANNOT get the hang of SX vs. SV versus VA
> versus PV.

You're almost there, but not quite. XS does not take PV or any
other operator, just Save/Get numbers: .

The VA operator you're looking for is VA@nn (note the ampersand
after the "VA"), where nn is the S/G number: , , etc.
It returns the first 77 bytes of the named S/G. If the named S/G is
uninitialized,  returns the null string -- unlike ,
which crashes if S/G nn is uninitialized.

VA@ has a built-in capability to parse around around single-
character separators. Suppose that S/G 03 contains FILENAME.EXT
(). The separator is ".";  returns
"FILENAME", and  returns "EXT". (See example in the
corrected code, below.)

 is technically correct, but unnecessary. Since "." is a
string, which does not require evaluation, you can SaVe it directly,
without quotes, using SV: 

Here is your original routine, with corrections:

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}SX50,{<}VA$FP{>}{>}[JM_]2.GetPath[Q2_][BX_]ne temp.txt[Q2_
][GT_][cr|lf][cr|lf]path is {<}PV50{>}[cr|lf]filename is {<}P
V51{>}[cr|lf]{<}SV02,.{>}{<}XS51,02,03,04,05{>}[cr|lf][cr|lf]
Newfile is {<}PV03{>}.ps[cr|lf];*; or, more succinctly:[cr|lf
]{<}SX03,{<}VA@51.1{>}{>}[cr|lf][cr|lf]Newfile is {<}PV03{>}.
ps[cr|lf][cr|lf]
-nd
XPLeNCODE

Hope this helps.

--
Carl Distefano
cld@xxxxxxxx