"Fill String" Replicate Characters - TechRepublic
General discussion
August 8, 2002 at 09:26 PM
tcobbs

“Fill String” Replicate Characters

by tcobbs . Updated 23 years, 11 months ago

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

This discussion is locked

All Comments