'''
'''  FF_REPEAT
'''  返回由指定的字符串的多个副本组成的字符串。
'''
'''  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


''
''  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



