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

Re: U2 frame



Reply to note from Harry Binswanger  Sat, 10 Sep
2011 18:36:59 -0400

Harry:

> How [1] are [2] you?
>
> I want to end up with:
>
> How [2] are [1] you?

I'd handle this is with good old XPL parsing (XS operator). Here's a
demo. RUN it against itself. Experiment with different input strings
(S/G 01) and substrings to swap (S/Gs 02 and 03).

XPLeNCODE v2.0
b-gin [UNTITLED]
;*; SWAP12.PM [CLD 9/10/11][cr|lf];*; Swap all instances of{032}
two substrings in the input string (demo)[cr|lf];*;[cr|lf];*;
 Usage:[cr|lf];*; With SWAP12.PM in current window, command:[
cr|lf];*; RUN SWAP12.PM[cr|lf];*;[cr|lf]{<}SV01,How [;
1] are [;2] you and [;2] you and [;1] you?{>};*; Input string
[cr|lf]{<}SV02,[;1]{>};*; Substring 1[cr|lf]{<}SV03,[;2]{>};*
; Substring 2[cr|lf];*;[cr|lf]{<}SV04,{>}{<}SX05,{<}IS01{>}{>
}{<}LBa{>}{<}IF{<}IS05{>}{240}{<}IS02{>}{>}{<}SV06,{>}{<}XS05
,02,07,,06{>}{<}LBb{>}{<}IF{<}IS07{>}{240}{<}IS03{>}{>}{<}SV0
8,{>}{<}XS07,03,09,,08{>}{<}SX07,{<}IS09{>}+{<}IS02{>}+{<}IS0
8{>}{>}{<}GLb{>}{<}EI{>}{<}SX04,{<}IS04{>}+{<}IS07{>}+{<}IS03
{>}{>}{<}SX05,{<}IS06{>}{>}{<}GLa{>}{<}EI{>}{<}LBc{>}{<}IF{<}
IS06{>}{240}{<}IS03{>}{>}{<}SV08,{>}{<}XS06,03,07,,08{>}{<}SX
06,{<}IS07{>}+{<}IS02{>}+{<}IS08{>}{>}{<}GLc{>}{<}EI{>}{<}SX0
4,{<}IS04{>}+{<}IS06{>}{>}[BF_]Old: {<}GT01{>}[255+048+068]Ne
w: {<}GT04{>}[255+048+068]{<}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx