Return to String Function Index
String Function Syntax and Examples
PAD( )The PAD() function adds a specified character to both sides of a string until a specified length is reached. Use this function to center values within a field.
Syntax:
PAD(string,length,char)
where:
- length is the desired number of characters for the string. If this total requires an odd number of characters to be added to the string, the extra character will be added to the left.
- char is the character to be added to the string. If a string or expression is specified, the function uses the first character of the string or expression result.
Example:input: samplestring
IMPORT @sample.dat
{RECORD
{
field1 *\r\n
}
schema1.table1
{
col1 PAD(field1,18,'X')
col2 PAD(field1,17,'X')
}}
Results:
schema1.table1.col1 XXXsamplestringXXX schema1.table1.col2 XXXsamplestringXX
Return to String Function Index