Web Development

General discussion


"Fill String" Replicate Characters

By tcobbs ·
A recent article (yesterday?) described a VB program to replicate a pattern of characters into a string. Below is a "sub" version of the same program that uses recursion to run in fewer iterations on large strings.

Public Sub FillString( _
ByVal Value As String, _
ByVal StringLength As Integer, _
ByRef Result As String)

Result = Result & Value
Do While Len(Result) < StringLength
FillString Value & Value, StringLength, Result

Result = Left(Result, StringLength)
End Sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums