creverse (Aug2004) |
rjtools
|
creverse (Aug2004) |
creverse
creverse - reverse order of characters/fields in a character string
creverse cline [delim] [verbose]
- cline = ""
- Character string to reverse
- delim = ""
- Arbitrary field delimiting character or multi-character string. 'delim'
defaults to the empty string (\"\")
- verbose = no
- Print the reverse of 'cline' to the standard output?
- (revstr) [string]
- Parameter returning the reversed input character string
Task to reverse either the order of all characters in a character
string, when 'delim' = \"\", or the order of all fields in a character
string, when 'delim' is defined (non-empty). The field delimiter may be
an arbitrary single character (e.g., " ", ":", ",", "/", etc..) or
multi-character string (e.g., "//", ".fits", "-->", etc..). Upon exit
of this task, 'revstr' will contain the reversed input character string.
If the 'verbose' switch is set, the result is also printed to the standard
output.
1. Reverse the characters in an input string:
rj> creverse ("abc def g", delim="", verbose+)
g fed cba
rj> creverse ("abc def g", delim=" ", verbose+)
g def abc
rj> gdate() ; creverse (gdate.ndate, delim="/", verbose-)
rj> print("old: "//gdate.ndate//", new: "//creverse.revstr)
old: 2004/08/24, new: 24/08/2004