Viva Clipper !

CharMirr()

Advertisements

CHARMIRR()

Mirror a string

Syntax

      CHARMIRR( <[@]cString>, [<lDontMirrorSpaces>] ) -> cMirroredString

Arguments

<[@]cString> is the string that should be mirrored [<lDontMirrorSpaces>] if set to .T., spaces at the end of <cString> will not be mirrored but kept at the end Default: .F., mirror the whole string

Returns

<cMirroredString> the mirrored string

Description

The CHARMIRR() function mirrors a string, i.e. the first character will be put at the end, the second at the last but one position etc.. One can use this function for index searches, but then, the spaces at the end of the string should not be mirrored. One can omit the return value of the function by setting the CSETREF() switch to .T., but <cString> must then be passed by reference to get a result.

Examples

      ? charmirr( "racecar" )        // "racecar"
      ? charmirr( "racecar  ", .T. ) // "racecar  "
      ? charmirr( "racecar  ", .F. ) // "  racecar"

Tests

      charmirr( "racecar" ) == "racecar"
      charmirr( "racecar  ", .T. ) == "racecar  "
      charmirr( "racecar  ", .F. ) == "  racecar"

Compliance

CHARMIRR() is compatible with CT3’s CHARMIRR().

Platforms

All

Files

Source is charmirr.c, library is ct3.

Seealso

CSETREF()

Advertisements

Advertisements