Difference between revisions of "STR PAD()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to pad out a character string to a defined length
 
Function to pad out a character string to a defined length
 
  
 
==Syntax==
 
==Syntax==
 
STR_PAD(<expC1>,<expN>,[<expC2> [,<pad_type>]])  
 
STR_PAD(<expC1>,<expN>,[<expC2> [,<pad_type>]])  
 
  
 
==See Also==
 
==See Also==
 
[[CENTER()]], [[LPAD()]], [[PADC()]], [[PADL()]], [[PADR()]], [[RPAD()]], [[SET STRESCAPE]], [[STR()]], [[STRTRAN()]], [[STRZERO()]], [[STUFF()]]
 
[[CENTER()]], [[LPAD()]], [[PADC()]], [[PADL()]], [[PADR()]], [[RPAD()]], [[SET STRESCAPE]], [[STR()]], [[STRTRAN()]], [[STRZERO()]], [[STUFF()]]
 
  
 
==Description==
 
==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:
 
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:
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|<pad_type>||Description
!<pad_type>||Description
+
 
|-
 
|-
 
|STR_PAD_RIGHT||Default behavior as above
 
|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
+
|valign="top"|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
+
|valign="top"|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.
 
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==
 
==Example==
Line 35: Line 29:
 
abcddd
 
abcddd
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==
Recital Server, Recital
+
Lianja Server, Lianja
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:String Data]]
 
 
[[Category:String Data Functions]]
 
[[Category:String Data Functions]]

Latest revision as of 06:47, 4 February 2013

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

Lianja Server, Lianja