hello friends,
how to separate all characters from a given string in vb6.0...For example if i give "welcome" in a text box ,in the same form it will print (w,e,l,c,o,m,e,)..........
Thanks in advance ...............
regards natraj

Hi, Use Mid() function or Left() or Right() function for separating the characters and Len () function for Length .

Hi,
Try this code:

Private Function SeparateString(str As String) As String
    Dim x As Integer
    Dim retStr As String
    
    retStr = ""
    For x = 1 To Len(str)
        retStr = retStr & Mid(str, x, 1) & ","
    Next x
    SeparateString = retStr
End Function

It is a function that receives the string you want to separate, and returns the separated string.
Hope it helps.

:) I have a regsubex function, and in that case all you would need to call, is regsubex(String,"\B",chr(44)) :-)

Public Function regsubex(Text As String, Pattern As String, ReplaceVar As String) As String
    Dim myRegExp As RegExp
    Set myRegExp = New RegExp
    myRegExp.IgnoreCase = True
    myRegExp.Global = True
    myRegExp.Pattern = Pattern
    Dim txt As String
    txt = myRegExp.Replace(Text, ReplaceVar)
    regsubex = txt
End Function

Thanks it's working

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.