Seiki Batch Script > String Functions

$pad

Returns a copy of a string, padded with space characters to the specified length

Class: String

Parameters:  $string – String to extend

                     d – Integer specifying required string length

Syntax: $returnString=$pad($string, d)

Returns:

•      If d≤length of $string - A string identical to $string

•      If d>length of $string - A string containing $string but left aligned and padded to the right with as many space characters as required to create a length of d

•      If d<0 - A string containing $string but left aligned and padded to the right with as many space characters as required to create a length of d

Remarks: None

Example:

//Example for the string $pad method

$s=”SEIKI BATCH SCRIPT” //Set string

$result=”|” + $pad($s, 25) + “|” //Result (= ‘|SEIKI BATCH SCRIPT     |”)

message(“Right padding of “ + $s + “ is “ + $result) //Display results message

$result=”|” + $pad($s, -25) + “|” //Result (= ‘|     SEIKI BATCH SCRIPT|”)

message(“Left padding of “ + $s + “ is “ + $result) //Display results message

 

See Also:    $padleft

                  $padright

                  $trim