Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

$REVERSE

Draft MDC Standard

7.1.5.21 $REverse

$RE[VERSE] ( expr )

See Clause 7 for the definition of expr.

This form returns a string whose characters are reversed in order compared to expr.

$REverse( EXPR ) is computationally equivalent to $$REV( EXPR ) which is defined by the following code:

REV(E) Q $Select(E="":"",1:$$REV($Extract(E,2,$Length(E)))_$Extract(E,1))

Editor’s note:
Since the above recursive algorithm cannot be executed on a system that conforms exactly to the portability requirements (120 Do levels, strings longer than 120 characters), suggest to change this to:
REV(E) New i,r
Set r="" For i=1:1:$Length(r) Set r=$Extract(e,i)_r Quit r
Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 14-Nov-2023, 21:32:36.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)