PadLeft
Name | PadLeft |
Syntax | PadLeft (String str, String padChar, Integer length) |
Purpose | To pad a string to the left with the specified character. |
Description | Returns the characters in string padded to the left. Length of string is equal to length size. This method does not truncate the original string so if the original string is larger than specified length, the entire original string is returned. |
Return Type | String |
Parameters | Str [System.String] – String which will be padded to the right padChar [System.String] – A character string whose first character will be used to pad the string length [System.Int64] – Length of the output string |
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FypTBdwW66aRmhdBWD81B%252F0.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=20cc44f5&sv=1)
Example
In this example, we are passing the required parameters to the function transformation object using a Variables object.
Where,
str = ABC
padChar = -
length = 10
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FccEJDraGQPWA6TOMOzyg%252F1.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=cbbc84de&sv=1)
Right-click on the function transformation object and select Preview Output. You can see that Astera Data Stack has returned the padded string of the specified length.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F3083465318-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsR50Wa7EwZGlmPSAMkkf%252Fuploads%252FUz1HhAXfcYrwt8OCOuSW%252F2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=bdf4f82a&sv=1)
Last updated