string handling

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2008
Posts: 8
Reputation: bprabhumdu is an unknown quantity at this point 
Solved Threads: 0
bprabhumdu's Avatar
bprabhumdu bprabhumdu is offline Offline
Newbie Poster

string handling

 
0
  #1
Jul 26th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: string handling

 
0
  #2
Jul 26th, 2008
Hi, Use Mid() function or Left() or Right() function for separating the characters and Len () function for Length .
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 51
Reputation: dmf1978 is an unknown quantity at this point 
Solved Threads: 7
dmf1978's Avatar
dmf1978 dmf1978 is offline Offline
Junior Poster in Training

Re: string handling

 
0
  #3
Jul 26th, 2008
Hi,
Try this code:
  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.
-- Martín
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 4
Reputation: chid_ is an unknown quantity at this point 
Solved Threads: 1
chid_ chid_ is offline Offline
Newbie Poster

Re: string handling

 
0
  #4
Jul 26th, 2008
I have a regsubex function, and in that case all you would need to call, is

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

  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
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 8
Reputation: bprabhumdu is an unknown quantity at this point 
Solved Threads: 0
bprabhumdu's Avatar
bprabhumdu bprabhumdu is offline Offline
Newbie Poster

Re: string handling

 
0
  #5
Jul 27th, 2008
Thanks it's working
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC