UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> RPad    

' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
' You are free to use this code in any application,
' provided this notice is left unchanged.
' REV  DATE                          DESCRIPTION
' 1.0  2010-Oct-3              initial release
' 1.1  2011-Mar-30             Optimized.

'This function will right pad a string with a specified
'character. It accepts a base string which is to be right padded with
'characters, a character to be used as the pad character, and a
'length which specifies the total length of the padded result.
Function Rpad(MyValue As String, MyPadCharacter As String, MyPaddedLength As Integer) As String

   If Len(MyValue) < MyPaddedLength And Len(MyPadCharacter) > 0 Then
       Rpad = Left(MyValue & String(MyPaddedLength, MyPadCharacter), MyPaddedLength)
       Rpad = MyValue
   End If

End Function

see also: LPad

Creative Commons License
RPad by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search

Thank you for your support!
This page has been accessed 10,796 times.  This page was last modified 08:54, 6 April 2011 by Jack Leach. Contributions by Brent Spaulding, Alan Greenwood and Glenn Lloyd  Disclaimers