Completes the text by the left with the fill value until obtain a text of the indicated length. Returns the resulting string. If the fill value
consist of more than one character, the result can be greater than the indicated length. The length of the fill characters is a multiple of the length of the
fill string, it means that if the fill string is of 2 characters, the total fill characters will be 2,4,6,8 ...
1 string.lpad
<string.lpad>
<text /> !
<size /> !
<fill /> !
</string.lpad>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Etext | string | Text or string to process. | |||
Esize | integer | Length which should be completed. | |||
Efill | string | String with which you should complete until the indicated position. |
Returns | |
---|---|
Type | Description |
string | Returns the resulting text or string of perform the fill operation. |
Exceptions
requires 3 arguments, received: ...
The 3 entry parameters has not been specified.
Example
Copy
<xsql-script name='string_lpad_sample1'> <body> <set name='text'>hello world, I'm HAL</set> <set name='size'>25</set> <set name='fill'>$</set> <println><string.lpad><text/><size/><fill/></string.lpad></println> <!-- In this example, the total size exceeds the indicated. --> <set name='text'>hello world, I'm HAL</set> <set name='size'>25</set> <set name='fill'>XYZ</set> <println><string.lpad><text/><size/><fill/></string.lpad></println> </body> </xsql-script>
Returns:
Copy
$$$$$hello world, I'm HAL XYZXYZhello world, I'm HAL