REPLLEFT()

REPLLEFT()

Replace certain characters at the left of a string

Syntax

      REPLLEFT( <cString>, <cReplace|nReplace>,
                                [<cSearch|nSearch>] ) -> cString

Arguments

<cString> [@] Designates the string that is processed.

<cReplace|nReplace> Designates the character that replaces the character in <cSearch|nSearch> at the beginning of the <cString>.

<cSearch|nSearch> Designates the character at the beginning of <cString> that is replaced by <cSearch|nSearch>. The default value is a

space, CHR(32).

Returns

The processed <cString> is returned.

Description

REPLLEFT() can be used to exchange all leading characters in a string for any other selected character.

Note

. The return value of this function can be suppressed by implementing CSETREF() to save space in working memory.

Examples

       .  Replace the leading spaces with zeros:
          ? REPLLEFT("  1234", "0")              // "001234"
       .  Replace the leading zeros with spaces:
          ? REPLLEFT("001234", " ", "0")         // "  1234"
       .  Replace only the leading spaces:
          ? REPLLEFT("  1    ", "0")             // "001   "

Compliance

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

Platforms

All

Files

Source is replace.c, library is libct.

Seealso

REPLALL(), REPLRIGHT(), CSETREF(), Introduction

Advertisements

2 responses to “REPLLEFT()

  1. Pingback: Harbour All Functions – R | Viva Clipper !

  2. Pingback: Harbour String Functions | 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