[Resolved] Insert Space Every X Character
Hello, I've been racking my brain out trying to figure out how to do this!
What i want to do is Insert a space every X character so like if i wanted a space every 3 characters...
"HelloEveryoneHowAreYouGoing?I'mFine!"
to
"Hel loE ver yon eHo wAr eYo Goi Ng? I'm Fin e!"
Some of the problems that i have is when i insert a space the length of the string changes and i need to count four instead of 3 for the changed bit. Also with the maths, does it effect it if the string length doesn't divide by 3 completely (such as above)?
Can you please help me come up with this code!
Re: Insert Space Every X Character
VB Code:
Function StringSpace()
Dim aString As String
aString = "HelloEveryoneHowAreYouGoing?I'mFine!"
Dim output As String
output = ""
For i = 1 To Len(aString)
output = output & Mid(aString, i, 1)
If (i Mod 3 = 0) Then
output = output & " "
End If
Next
MsgBox output
End Function
Re: Insert Space Every X Character