PADRIGHT()

PADRIGHT()

Fills string to a certain length on the right

Syntax

       PADRIGHT( <cString>, <nLength>, [<cChar|nChar>] ) -> cString

Arguments

<cString> The string that is processed. <nLength> The selected new length for <cString>. <cChar|nChar> The character with which the beginning of the <cString> string is filled. The default value is a space, CHR(32).

Returns

The processed <cString> is returned.

Description

PADRIGHT() allows you to pad the end of a character string with characters, in accordance with a length specification. Spaces or any other characters that you choose can be used.

Notes

. The function works like the Harbour LEFT() function when <nLength> is shorter than the length of <cString>. If <nLength> is negative, PADRIGHT() returns a null string. . When the <cCharacter|nCharacter> parameter is not specified, spaces are automatically used for padding.

Examples

       .  The function works like LEFT():
              ? PADRIGHT("123456", 4)              // "1234"
           .  Pad the right with spaces:
              ? PADRIGHT("123456", 8)              // "123456  "
           .  Pad the right with the "." character:
              ? PADRIGHT("123456", 8, ".")         // "123456.."

Compliance

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

Platforms

All

Files

Source is pad.c, library is libct.

Seealso

PADLEFT()

2 responses to “PADRIGHT()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – P | 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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.