Seiki Batch Script > String Functions

$padleft

Returns a right-aligned copy of a string, padded on the left with Unicode characters for a specified total length

Class: String

Parameters:  $string – String to extend

                     d – Integer specifying required string length

                     $ch – Padding string

Syntax: $returnString=$padleft($string, d, $ch)

Returns:

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

•      If d>length of $string - A string containing $string but right aligned and padded to the left with as many part or whole $ch strings as required to create a length of d

Remarks: None

Example:

//Example for the string $padleft method

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

$padstring=”abc”

$result=”|” + $padleft($s, 25, $padstring) + “|” //Result (= ‘|abcabcaSEIKI BATCH SCRIPT|”)

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

 

See Also:    $pad

                  $padright

                  $trim