Featured Worklog

Price Search



PC Apex Sponsor


PC Apex Sponsors



PC Apex RSS Feeds

RSS Feed for PC Apex Reviews & ArticlesRSS Feed for PC Apex PC Modding WorklogsRSS Feed for the PC Apex Daily DisturbanceRSS Feed for the latest PC Apex Site NewsRSS Feed for PC Apex Affiliate and Web NewsRSS Feed for PC Apex Deals and Steals

Go Back   Apex Community Forums // Other Forums // Designers Corner // Coding / Scripting / Programming

Coding / Scripting / Programming Discussions on all manner of coding and scripting.

Reply
 
LinkBack Thread Tools Display Modes
Old 13-June-06, 11:34 PM   #1 (permalink)
Apex Master Tech
RAA_Kr1cH's Avatar
Default VB.NET array element counter

I'm trying to get code working that will take a report, remove everything so that all of the words are seperated by the space delimeter, assign that big old long string to an array using the split command. Then I want to count the number of times a word exists in the array. I'm having issues with my counter, and all I can get the counter to do is count the total number of words, not how many times each word exists in the array.

Thanks for any input/help
RAA_Kr1cH is offline     Reply With Quote
Old 13-June-06, 11:38 PM   #2 (permalink)
Sir Knight of Spamalot
Nerdz's Avatar
Default Re: VB.NET array element counter

Sounds Complex, I know you can use the Trim Function with Input boxes, but I dont know if it will work with Arrays.
Nerdz is offline     Reply With Quote
Old 24-June-06, 01:08 PM   #3 (permalink)
Master VB Pr'hoe'grammer
Monsignor Funkibut's Avatar
Wink Re: VB.NET array element counter

Build a second array; here's some pseudo code

Dim SecondArray[x,2] //x is how many unique words you expect

init SecondArray[x,1] = ""
Init SecondArray[x,2] = 0

for i=1 to len(FirstArray) //FirstArray is where all the words are stored
CurWord$ = FirstArray[i]
CurDex = WhereInSecondArray(CurWord$)
SecondArray[CurDex,2] = SecondArray[CurDex,2} + 1
next i

function WhereInSecondArray(AWord$) as integer

TheDex = 0

for i = 1 to len(SecondArray)
if Aword$ = SecondArray[i,1]
TheDex = i
endif
next i

if TheDex = 0 then //You didnt find the word you have to add it to first null element
for i = 1 to len(SecondArray)
if SecondArray[i,1]="" then
SecondArray[i,1] = AWord$
TheDex = i
endif
next
endif //Adding a word

return TheDex


This is HUGELY inefficient, you could add some additional pointers and go much faster.
It is however a start
HTH
-MF
Monsignor Funkibut is offline     Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slashdot // Long-lived Super Heavy Element Created Gizmo Slashdot RSS 0 28-December-06 06:00 AM
The Register // Boffins brew up new element Gizmo The Register RSS 0 17-October-06 07:05 PM
Affiliate Review: SilverStone Element 400Watt PSU ST40EF THRiLL KiLL PC Apex Web News 0 17-October-06 08:45 AM
Affiliate Review: SilverStone Element ST50EF-Plus 500W Power Supply THRiLL KiLL PC Apex Web News 0 28-August-06 01:02 AM
Affiliate Review: SilverStone ELEMENT ST50EF 500w Power Supply Twizted PC Apex Web News 0 20-July-06 03:09 AM


All times are GMT -5. The time now is 09:52 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright PCApex.com, GameApex.com, ForumApex.com 2001 - 2008
Advertisements

Page generated in 0.13518 seconds with 9 queries