The Right function returns the trailing portion of a string, for a certain length. If the string is shorter than the requested length, the result is prefixed on the left with as many pad characters as required.
| result = Right( string, length [, pad ] ) |
|
Examples:
say Right( 'Shazam', 4 ) -- shows: azam say Right( 'Shazam', 8, '+' ) -- shows: ++Shazam say Right( 3.40, 6, '0' ) -- shows: 003.40 say Right( 'Go now and do right', 5 ) -- shows: right, .. the phrase is attributed to Theodore Roosevelt |
Observe:
The Right function does not remove leading spaces in the original string. This can cause a perplexing defect. Consider the following:
text = ' defghij' /* the space on the left can be hard to see */ text = 'abc'right( text, 8, '_' ) /* pad text on left with an underscore */ say text /* shows: abc defghij ... EXPECTED: abc_defghij */ |