Official Content

Builds a character expression from another one, by adding a specified character N times, or blanks to its right side.

Syntax

Str.PadRight(Len [,FillChar])

Where:

Str 
   Is the character expression from which you want to add right 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 right side of ‘Str’. It is an optional parameter, if it is not specified then blanks will be added.

Type Returned:
Character

Scope

Data Types: Character, VarChar, LongVarChar
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 right side of ‘Str’ as many times until the string is left as long as 'len'.

Samples

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

See Also

PadR function
PadL function
PadLeft method
Trim function
LTrim function
RTrim function

    


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