Click here to Skip to main content
16,004,227 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
I am reading a file using stream reader and when doing so i read the file line by line and i get the line as follows
BH01803502625DUNCAN JOHNNY 03092010M362340313

now when I search it with Johnny i have to get other two strings
BH01803502625DUNCAN and 03092010M362340313 

pl help in doing it

thanks
Abinav Shankar
Posted
Updated 1-Dec-11 18:19pm
v2
Comments
Manoj K Bhoir 2-Dec-11 0:20am    
Edited to highlight your problem!

1 solution

It's very simple.If you know some basic String Functions you can do it easily.Check this code :
VB
Dim s As String = "BH01803502625DUNCAN JOHNNY 03092010M362340313"
'It this is your String
MessageBox.Show(s.Substring(0, s.IndexOf(" ")) & " and " & s.Substring(s.LastIndexOf(" ") + 1))

I hope it will solve your problem. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900