Difference between revisions of "STR PAD()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
Function to pad out a character string to a defined length from the right
+
Function to pad out a character string to a defined length
  
  
Line 8: Line 8:
  
 
==See Also==
 
==See Also==
[[CENTER()]], [[LPAD()]], [[PADC()]], [[PADL()]], [[PADR()]], [[RPAD()]], [[STR()]], [[STRTRAN()]], [[STRZERO()]], [[STUFF()]]
+
[[CENTER()]], [[LPAD()]], [[PADC()]], [[PADL()]], [[PADR()]], [[RPAD()]], [[SET STRESCAPE]], [[STR()]], [[STRTRAN()]], [[STRZERO()]], [[STUFF()]]
  
  

Latest revision as of 15:15, 22 July 2010

Purpose

Function to pad out a character string to a defined length


Syntax

STR_PAD(<expC1>,<expN>,[<expC2> [,<pad_type>]])


See Also

CENTER(), LPAD(), PADC(), PADL(), PADR(), RPAD(), SET STRESCAPE, STR(), STRTRAN(), STRZERO(), STUFF()


Description

The STR_PAD() function left-justifies a character string <expC1> and pads out the right of the string, to a total length of <expN> characters, with blank spaces. The optional <expC2> may be used to pad <expC1> with a character string instead of blank spaces. If the optional <pad_type> is included, the string is processed as follows:


<pad_type> Description
STR_PAD_RIGHT Default behavior as above
STR_PAD_LEFT <expC1> is right justified and padded to the left to a total of <expN> characters
STR_PAD_BOTH <expC1> is centered and padded to the left and right to a total of <expN> characters


The STR_PAD() function is useful for creating fixed length character strings by padding them out with blanks. If the string being processed is longer than the specified total length, no padding takes place.


Example

? str_pad("abc",6,"d")
abcddd


Products

Recital Server, Recital