| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Pads a character string on the right.
PadLeft( <cString>, ;
<nLength>, ;
[<xChar>] ) --> cResult
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.
| See also: | Center(), PadC() | PadL() | PadR(), PadLeft() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\ctpad.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// 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
http://www.xHarbour.com