- Home
·
- String Manipulation
·
- You can use this module to add one string to another at set intervals or at a specified position wi
You can use this module to add one string to another at set intervals or at a specified position wi
You can use this module to add one string to another at set intervals or at a specified position without writing over any text that currently
Rate You can use this module to add one string to another at set intervals or at a specified position wi
(2(2 Vote))
'AddToString Module by Xavior Gates'
Public Function AddToStringAtIntervals(ByVal theString As String, ByVal theReplacement As String, ByVal theInterval As Long) As String
j = 0
Dim theStringParts(0 To 100) As String
firstRun = True
For i = 1 To Len(theString) Step theInterval
theStringParts(j) = Mid(theString, i, theInterval)
j = j + 1
Next i
theString = vbNullString
For i = 0 To j
If firstRun = True Then
theString = theStringParts(i)
firstRun = False
Else
theString = theString + theReplacement + theStringParts(i)
End If
Next i
For i = Len(theString) - Len(theReplacement) + 1 To Len(theString)
Mid(theString, i) = " "
Next i
AddToStringAtIntervals = RTrim(theString)
End Function
Public Function AddToStringAtIndex(ByVal theString As String, ByVal theReplacement As String, ByVal theIndex As Long) As String
Dim theStringParts(0 To 1) As String
theStringParts(0) = Mid(theString, 1, theIndex)
theStringParts(1) = Mid(theString, theIndex + 1)
theString = vbNullString
theString = theStringParts(0) + theReplacement + theStringParts(1)
AddToStringAtIndex = theString
End Function
You can use this module to add one string to another at set intervals or at a specified position wi Comments
No comments yet — be the first to post one!
Post a Comment