RosettaCodeData/Task/Generic-swap/NetRexx/generic-swap.netrexx

22 lines
766 B
Plaintext

/* NetRexx */
options replace format comments java crossref symbols nobinary
-- Simple values with no spaces can be swapped without the use of a parse template
lval = 27
rval = 5
say 'Before - <lval>'lval'</lval> <rval>'rval'</rval>'
parse (lval rval) rval lval
say 'After - <lval>'lval'</lval> <rval>'rval'</rval>'
say
-- More complex data needs to use some form of parsing template
lval = 'This value started on the left'
rval = 'This value started on the right'
dlm = 12x80facebead01 -- some delimiting value that is unlikely to occur in the LVAL to be swapped
say 'Before - <lval>'lval'</lval> <rval>'rval'</rval>'
parse (lval || dlm || rval) rval (dlm) lval
say 'After - <lval>'lval'</lval> <rval>'rval'</rval>'
say
return