Below you'll find the source for the Visual Basic 6 function chunk_split.
Attribute VB_Name = "modChunkSplit"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
'
' You may freely distribute this file but please leave all comments, including this one, in it.
'
' @Author Stefan Thoolen <mail@stefanthoolen.nl>
Option Explicit
''
' Split a string into smaller chunks
' Same syntax as the PHP function 'chunk_split'
' See also: http://www.php.net/manual/en/function.chunk-split.php
' @param string body The string to be chunked.
' @param integer chunklen The chunk length. Defaults to 76
' @param string endstr The line ending sequence. Defaults to vbCrLf
' @return string Returns the chunked string
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function chunk_split(ByVal body As String, Optional ByVal chunklen As Integer = 76, Optional endstr As String = vbCrLf)
Dim l As Long, retval As String
For l = 1 To Len(body) Step chunklen
retval = retval & Mid(body, l, chunklen) & endstr
Next l
chunk_split = retval
End Function