Results 1 to 3 of 3

Thread: PAD (L, R) functions

  1. #1
    Guest
    Does anyone knows what has happened to PAD, PADL, PADR functions? Were they removed from VB6? I'm trying to use them but VB6 doesn't seem to recognise any of them. I used them so many times in previous versions, no problems. I have my own function which does the same thing, but I'm just curious. Thanx

  2. #2
    Guest
    Code:
     '*********************************************************************
       'Declarations section of the module.
     '*********************************************************************
       Option Explicit
       Dim x As Integer
       Dim PadLength As Integer
    
     '=====================================================================
       'The following 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$, MyPadCharacter$, MyPaddedLength%)
    
          Padlength = MyPaddedLength - Len(MyValue)
          Dim PadString As String
          For x = 1 To Padlength
             PadString = PadString & MyPadCharacter
          Next
          Lpad = PadString + MyValue
    
       End Function
    
     '=====================================================================
       'The following 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$, MyPadCharacter$, MyPaddedLength%)
    
          Padlength = MyPaddedLength - Len(MyValue)
          Dim PadString As String
          For x = 1 To Padlength
             PadString = MyPadCharacter & PadString
          Next
          Rpad = MyValue + PadString
    
       End Function

  3. #3
    Guest

    Cool

    Thanx for the reply, but I was just wondering what happened to the functions, I already got similiar function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width