Format

Combines strings and extracts a specific substring of a string. You can format the result to a specific length and fill it with appropriate characters.

SYNTAX
Format(startPosition, numberCharacters, resultLength, formatRule, fillCharacter,formatParams) 
ARGUMENTS

startPosition Start position beginning from 1.
numberCharacters Number of characters from the start position to cut off.
resultLength Maximum length of the result string. 0 means the result string has no length restriction.
formatRule

L = left-aligned

R = right-aligned

Z = centered

fillCharacter Filling character if the result string does not have the required length.
formatParams Data strings to link together.

RETURN Formatted text

Example

Date = "1.7.2014"

Day = Format(3, 1, 2, "R", "0",Date) ;   Day   ==> "07"

Month = Format(1, 1, 2, "R", "0",Date) ; Month   ==> "01"

Year = Format(5, 4, 4, "R", "0",Date) ;  Year   ==> "2014"

;-------------------------------------------

Name = "John James Miller"

; subst without padding

Name1 = Format(6, 50, 0, "L", "_", Name); Name1 = "James Miller"

Name2 = Format( 1, 10, 0, "L", "_", Name); Name2 = "John James"

Name3 = Format(6, 5, 0, "L", "_", Name); Name3 = "James"

; subst with padding, text left aligned

Name4 = Format(6, 50, 20, "L", "_", Name); Name4 = "James Miller________"

; subst with padding, text right aligned

Name5 = Format(6, 50, 20, "R", "_", Name); Name5 = "________James Miller"

; subst with padding, text centered

Name6 = Format(6, 50, 20, "Z", "_", Name); Name6 = "____James Miller____"