Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replicate string
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00419529
Message ID:
00419634
Vues:
21
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform