CT_CHARSPREAD

 CHARSPREAD()
 Expands a string at the tokens
------------------------------------------------------------------------------
 Syntax

     CHARSPREAD(<cString>,<nLength>,
        [<cCharacter|nCharacter>]) --> cString

 Arguments

     <cString>  Designates a character string that is expanded with
     spaces or <cCharacter>|<nCharacter> characters to <nLength> length.

     <nLength>  Designates the length of the return string.

     <cCharacter|nCharacter>  Designates the fill character and token
     delimiter.  It can be a numeric value or a character.  If it is a
     numeric value, it must be between 0 and 255.  The default value is a
     space CHR(32).

 Returns

     CHARSPREAD() returns the expanded string.

 Description

     CHARSPREAD() expands a string to a preset length.  However, it behaves
     differently than the EXPAND() function.

     CHARSPREAD() uses <cCharacter|nCharacter> as the character to insert
     during the expansion.  The string is expanded between tokens delimited
     by this character up to the length specified by <nLength>.  This is
     similar to full justification in a text editor.

 Note

     .  Previously existing fill characters <cCharacter|nCharacter>
        are not taken into account in the redistribution (see examples).  If
        this procedure is not satisfactory to you, then you can call the
        CHARONE() for the string before you call CHARSPREAD().

 Examples

     For clarity, these examples do not contain blanks.

     .  When the delimiter does not appear in the string, no expansion
        takes place:

        ? CHARSPREAD("123456", 20, ".")          // "123456"

     .  This example shows a numeric code for the (".") character:

        ? CHARSPREAD("1.2.3.4.5.6", 20, 46)      // "1...2...3..4...5...6"

     .  In this example, the fill character is already there:

        ? CHARSPREAD("11..22..33", ".")          // "11.......22.......33"
        ? CHARSPREAD("11.22........33", 20, ".")
                                                 // "11....22..........33"

See Also: EXPAND() CHARONE()

 

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.