Need help in splitting a string

Ask questions about all versions of Visual Basic.NET (2002, 2003, 2005, 2008 & 2010) or anything to do with VB.NET programming.

Need help in splitting a string

Postby a_runjith » Sun Jul 04, 2010 10:28 pm

Please help
I really need some help in a project I've been working on. Its almost completed, but there is a place where i'm stuck on. I'm making a library project. There is a table with many records. Each record has a year, title, author, keywords and the loan numbers. loan numbers is the number of times the book has been borrowed.

What i need to find is, the 10 most popular books and the 10 most popular searches for a particular year. The search is used by keywords. the keywords are predefined. eg: medicine, cardiology. The first section is completed, to find the 10 most popular books. All i need to know is how to find out the 10 most popular searches. The problem is that the user can use multiple words in one single search. eg: if we need a book which describes postmortem, we can give the search as "medicine, postmortem". In this case there is two keyword in one particular search.

What I need to find is 10 popular search keywords, not the whole search string as given in example. I was hoping to do in such a way that all the keywords are inserted in an array and a count is made whenever a search is done and increment the value if the same keyword is repeated again. But in this case i may need to split the string if two or more keywords are used in a single search. I need help with that.

Please someone wide the code for me for this section.
the coding is done in VB.NET
Any help is appreciated.
Thank you
Arunjith.
a_runjith

 
Posts: 2
Joined: Sun Jul 04, 2010 10:22 pm

Re: Need help in splitting a string

Postby Keith » Mon Jul 05, 2010 8:13 pm

Welcome to the forum Arunjith. :vbwelcome:

You appear to have posted the same question in VB.Net which are you using?

Its obviously a database app which you can just search any of the Fields for the words you are after. ;)
I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Image
User avatar
Keith

 
Posts: 365
Joined: Tue Oct 13, 2009 12:15 am
Location: Staffordshire, England

Re: Need help in splitting a string

Postby Aeric » Mon Jul 19, 2010 1:59 pm

You can split the words using space.
Code: Select all
Dim strKW() as String
strKW = Split(strSearchString, " ")
User avatar
Aeric

 
Posts: 53
Joined: Sat Oct 17, 2009 11:28 am
Location: Kuala Lumpur, Malaysia

Re: Need help in splitting a string

Postby Keith » Mon Jul 19, 2010 2:39 pm

Aeric - until we know if he's using VB6 or VB.Net I dont know it .Net uses Split. He hasn't been back since.

I'll move it to VB.Net. ;)
I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Image
User avatar
Keith

 
Posts: 365
Joined: Tue Oct 13, 2009 12:15 am
Location: Staffordshire, England


Return to VB.NET

Who is online

Users browsing this forum: No registered users and 1 guest

cron