Function Rpad(ByVal MyValue$, ByVal MyPadCharacter$, ByVal MyPaddedLength%)
Dim x As Integer
Dim PadLength As Integer
Padlength = MyPaddedLength – Len(MyValue)
Dim PadString As String
For x = 1 To Padlength
PadString = MyPadCharacter & PadString
Next
Rpad = MyValue + PadString
End Function
Function lpad(ByVal MyValue$, ByVal MyPadCharacter$, ByVal MyPaddedLength%)
Dim x As Integer
Dim PadLength As Integer
PadLength = MyPaddedLength – Len(MyValue)
Dim PadString As String
For x = 1 To PadLength
PadString = PadString & MyPadCharacter
Next
lpad = MyValue + PadString
End Function
Hello !!
I try to use your code in VB6, and when i compile it, the vb compiler give me an error like “sintaxis error” in this line “Padlength = MyPaddedLength – Len(MyValue)”
Maybe is the declaration of the variables in the function ?
(ByVal MyValue$, ByVal MyPadCharacter$, ByVal MyPaddedLength%)
What mean the symbol $ and % ?
Tank you for your help..
I resolved rewriting the line … I had made copy and paste directly in first time… thanks