PlanetSquires Forums

Support Forums => General Board => Topic started by: Paul Squires on August 19, 2015, 01:46:02 PM

Title: FF_REPEAT
Post by: Paul Squires on August 19, 2015, 01:46:02 PM



''
''  FF_REPEAT
''  Return a string consisting of multiple copies of the specified string.
''
''  This function is very similar to STRING$ (which makes multiple copies
''  of a single character).
''
Function FF_Repeat( ByRef nCount      As Integer, _
                    ByRef sMainString As String _
                    ) As String

    If nCount <= 0 Then Return ""
   
    ' Create the final full buffer and insert the
    ' strings into it in order to avoid nCount concatenations.
    Dim nLen As Integer = Len(sMainString)
    Dim s    As String  = Space(nCount * nLen)
    Dim i    As Integer = 1
   
    For i = 0 To nCount - 1
       Mid(s,(i*nLen)+1,nLen) = sMainString
    Next
   
    Return s

End Function