The Left function returns the initial portion of a string, for a certain length. If the string is shorter than the requested length, the result is augmented on the right with as many pad characters as required.
|result = Left( string, length [, pad ] )|
say Left( 'Shazam', 4 ) -- shows: Shaz
say Left( 'Shazam', 8, '+' ) -- shows: Shazam++
The Left function does not remove trailing spaces in the original string. This can cause a perplexing defect. Consider the following:
text = 'abcdefg ' /* the space on the right can be hard to see */ text = left( text, 8, '_' )'hij' /* pad text on left with an underscore */ say text /* shows: abcdefg hij ... EXPECTED: abcdefg_hij */