|
|
CODE ' 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-Apr-4 Optimized. '===================================================================== 'This function will left pad a string with a specified 'character. It accepts a base string which is to be left 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 Lpad(MyValue As String, MyPadCharacter As String, MyPaddedLength As Integer) As String If Len(MyValue) < MyPaddedLength And Len(MyPadCharacter) > 0 Then Lpad = Right(String(MyPaddedLength, MyPadCharacter) & MyValue, MyPaddedLength) Else Lpad = MyValue End If End Function LPad can be used when you are dealing with numeric text and needing to sort it into numeric order. Sorting Text demonstrates the use of LPad in a query. See also RPad
|
| This page was last modified 08:51, 6 April 2011. This page has been accessed 2,052 times. Disclaimers |