Pad

Syntax:

    out_string = Pad( string_variable, byte_value_of_the_new_length, pad_character)

Command Availability:

Available on all microcontrollers

Explanation:

The Pad function is used to create string to a specific length that is extended with a specific character.

The length of the string is specified by the second parameter. The character used to pad the string is specified by the third parameter.

A typical use is to pad a string to be displayed on a LCD display.

Example:

    'Set chip model
    #chip 16F1936

    'Set up hardware serial connection
    #define USART_BAUD_RATE 9600
    #define USART_TX_BLOCKING


    'Defibe a string
    Dim TestData As String * 16
    TestData = "Location"

    HSerPrint TestData   ;will print a string of 8 characters
    HSerPrintCRLF
    Pad ( TestData, 16, "*" )
    HSerPrint TestData   ;will print a string of 'Location********'
HSerPrintCRLF