943,846 Members | Top Members by Rank

Ad:
Jul 26th, 2008
0

string handling

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bprabhumdu is offline Offline
8 posts
since Jun 2008
Jul 26th, 2008
0

Re: string handling

Hi, Use Mid() function or Left() or Right() function for separating the characters and Len () function for Length .
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Jul 26th, 2008
0

Re: string handling

Hi,
Try this code:
VB Syntax (Toggle Plain Text)
  1. Private Function SeparateString(str As String) As String
  2. Dim x As Integer
  3. Dim retStr As String
  4.  
  5. retStr = ""
  6. For x = 1 To Len(str)
  7. retStr = retStr & Mid(str, x, 1) & ","
  8. Next x
  9. SeparateString = retStr
  10. End Function
It is a function that receives the string you want to separate, and returns the separated string.
Hope it helps.
Reputation Points: 18
Solved Threads: 7
Junior Poster in Training
dmf1978 is offline Offline
51 posts
since Aug 2006
Jul 26th, 2008
0

Re: string handling

I have a regsubex function, and in that case all you would need to call, is

regsubex(String,"\B",chr(44)) :-)

vb Syntax (Toggle Plain Text)
  1.  
  2. Public Function regsubex(Text As String, Pattern As String, ReplaceVar As String) As String
  3. Dim myRegExp As RegExp
  4. Set myRegExp = New RegExp
  5. myRegExp.IgnoreCase = True
  6. myRegExp.Global = True
  7. myRegExp.Pattern = Pattern
  8. Dim txt As String
  9. txt = myRegExp.Replace(Text, ReplaceVar)
  10. regsubex = txt
  11. End Function
Reputation Points: 10
Solved Threads: 1
Newbie Poster
chid_ is offline Offline
4 posts
since Jul 2008
Jul 27th, 2008
0

Re: string handling

Thanks it's working
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bprabhumdu is offline Offline
8 posts
since Jun 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: editting existing txt file data
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: read multi line txt.file and display in textbox





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC