Discussion Locked

"Fill String" Replicate Characters

0 helpful
0 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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
Loop

Result = Left(Result, StringLength)
End Sub

0 replies

No replies were posted before this discussion closed.

This discussion is closed to new replies.