hey Jussi, if of course you prefer the integer approach rather than my approach you could try this one.
-------------------------------------------------------------------------------------------------- Dim tmpInitial as Integer tmpInitial = iMyArray.Find("my item") iMyArray[tmpInitial] &= "-beginning" While iMyArray.Find("my item")> -1 iMyArray.Remove(iMyArray.Find("my item")) Wend iMyArray[tmpInitial] = left(iMyArray[tmpInitial],-10) -------------------------------------------------------------------------------------------------- I think this approach might speed up things for you since you only go to the duplicate items and remove them one by one instead of going through the whole array. the string approach might also be of use to you try either one and see which one fits very well in your project :) I hope this helps Regards Dimitris On Fri, Aug 21, 2009 at 1:54 PM, Dimitris Anogiatis <dos...@gmail.com>wrote: > hey Jussi, > > I've tried a similar technique filtering about 5230 filenames and with my > old HyperThreaded p...@3ghz > It works pretty good for me :) > > as I said give it a try :) > > Regards > Dimitris > > > On Fri, Aug 21, 2009 at 1:49 PM, Jussi Lahtinen > <jussi.lahti...@gmail.com>wrote: > >> Usually string handling is slower than integer, although I haven't >> test that in Gambas. >> >> Jussi >> >> >> On Fri, Aug 21, 2009 at 22:43, Dimitris Anogiatis<dos...@gmail.com> >> wrote: >> > Hey Jussi, >> > >> > If you want to find the duplicate values in an array... give this trick >> a >> > try >> > >> > 1) turn the array into a string >> > 2) store it in a temp string variable >> > 3) find the first occurence of the value you want >> > 4) put the rest of the string in another temp variable >> > 5) do a replace(tempString, "what you want to replace,", "") >> > 6) concat the 2 temp strings together >> > 7) split the string back into an array >> > >> > If you notice in step 5 I included the coma in the string you want to >> > replace >> > and that's because we don't want any duplicate comas it'll screw up the >> > splitting process at the end >> > >> > It's less cpu intensive than doing a for loop to find the duplicates >> > (At least I think so, correct me if I'm wrong) >> > >> > I've used a similar technique to filter certain items from a string >> array >> > don't think this technique would work on other kinds of arrays >> > >> > I hope it helps >> > >> > Regards >> > Dimitris >> > >> > On Fri, Aug 21, 2009 at 1:34 PM, M0E Lnx <m0e....@gmail.com> wrote: >> > >> >> What I do also to avoid duplicates is check the array before you add >> >> the new entry to it >> >> >> >> IF MyArray.Find("YourString") = -1 THEN MyArray.Add("YourString") >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> >> trial. Simplify your report design, integration and deployment - and >> focus >> >> on >> >> what you do best, core application coding. Discover what's new with >> >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> >> _______________________________________________ >> >> Gambas-user mailing list >> >> Gambas-user@lists.sourceforge.net >> >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> >> >> > >> ------------------------------------------------------------------------------ >> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> > trial. Simplify your report design, integration and deployment - and >> focus on >> > what you do best, core application coding. Discover what's new with >> > Crystal Reports now. http://p.sf.net/sfu/bobj-july >> > _______________________________________________ >> > Gambas-user mailing list >> > Gambas-user@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/gambas-user >> > >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> trial. Simplify your report design, integration and deployment - and focus >> on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Gambas-user mailing list >> Gambas-user@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/gambas-user >> > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user