VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Parting Text Function

by Agron Kovaci (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 23rd December 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Parting Text Function

Rate Parting Text Function



            ByVal lLenPart As Long, _
            Optional sDelimiter As String = " ", _
            Optional bEnabledEvent As Boolean = True) As String
   
    If Len(sText) = 0 Then GoTo NoParting
    If lLenPart <= 0 Or lLenPart >= Len(sText) Then GoTo NoParting
    
    Dim sMidText     As String
    Dim sTextOut     As String
    Dim sTemp        As String
    Dim lLen         As Long
    
    On Error GoTo NoParting
    
    sTemp = Mid$(sText, 1, lLenPart)
    For lLen = lLenPart + 1 To Len(sText) Step lLenPart
        sMidText = Mid$(sText, lLen, lLenPart)
        sTextOut = sDelimiter & sMidText
        sTemp = sTemp & sTextOut
        If bEnabledEvent Then DoEvents
    Next

    PartingText = sTemp
    Exit Function
    
NoParting:
    PartingText = sText
End Function


Download this snippet    Add to My Saved Code

Parting Text Function Comments

No comments have been posted about Parting Text Function. Why not be the first to post a comment about Parting Text Function.

Post your comment

Subject:
Message:
0/1000 characters