CharMirr()

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

2 responses to “CharMirr()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – C | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s