Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replicate string
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00419529
Message ID:
00419634
Views:
20
>I'm looking for a 2 functions, 1 to Replicate a string a specific number of times and the other to pad a string. eg:
>?Replicate("X",5) 'Prints "XXXXX"
>?Pad("X",5,"O") 'Prints "XOOOO"
>
>These are easy enough to build but I am wondering if there are some built-in functions that I am missing.

You can use this custom-made Pad function:
Public Function Pad(ByVal pstrSource As String, _
                    ByVal pstrFiller As String, _
                    ByVal pintLen As Integer) As String
    Pad = Left$(Trim$(pstrSource) & String$(pintLen, pstrFiller), pintLen)
End Function
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform