xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

PadRight()

Pads a character string on the right.

Syntax

PadLeft( <cString>, ;
         <nLength>, ;
        [<xChar>]   ) --> cResult

Arguments

<cString>
This is the string to process.
<nLength>
A numeric value indicating the length of the returned string.
<xChar>
This is a single character or its numeric ASCII code that is added at the end of <cString>. It defaults to a blank space (Chr(32)).

Return

The function fills <cString> on the right side with <xChar> up to the length <nLength> and returns the result. If <nLength> is smaller than Len(<cString>) the string is truncated on the right side.

Info

See also:Center(), PadC() | PadL() | PadR(), PadLeft()
Category: CT:String manipulation , Character functions
Source:ct\ctpad.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines the difference between PadR() and PadRight()
// PadR() ignores a numeric third parameter

   PROCEDURE Main
      LOCAL cString := "12345"

      ? PadRight( cString, 3 )             // result: 123
      ? PadR( cString, 3 )                 // result: 123

      ? ">"+PadRight( cString, 7, 65 )+"<" // result: >12345AA<
      ? ">"+PadR( cString, 7, 65 )+"<"     // result: >12345  <

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe