Official Content

Builds a character expression from another one, by adding a specified character N times, or blanks to the left.

Syntax

Str.PadLeft(Len [,FillChar])

Where:

Str 
   Is the character expression from which you want to add left blanks or with the FillChar if indicated

Len 
   Is the numeric expression that indicates the length of the returned string.

FillChar 
   Is the character that is added to the left side of ‘Str’. It is an optional parameter, if it is not specified then blanks will be added.

Type Returned:
Character

Scope

Data Types: CharacterVarCharLongVarChar
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

Description

Returns a character string, which is the result of adding the ‘FillChar’ to the left side of ‘Str’ as many times until the string is left as long as 'len'.

Samples

&MyText = “My string”
&Result=&MyText.PadLeft(10, ‘*’) // &Result value is “*My string”
&MyText = “My string”
&Result=&MyText.PadLeft(11, ‘*’) // &Result value is “**My string”
&MyText = “My string”
&Result=&MyText.PadLeft(12, ‘*’) // &Result value is “***My string”
&MyText = “My string”
&Result=&MyText.PadLeft(12)       // &Result value is “   My string”
Note: All leading spaces from the original string will be removed before applying the function.

See Also

PadR function
PadL function
Trim function
LTrim function
RTrim function

   

  


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant