Re: [Gambas-user] To the wish list...

2009-08-21 Thread Doriano Blengino
Jussi Lahtinen ha scritto: > Meaning like this? Should be faster! > > Dim col As New Collection > > For ii = 0 To iMyArray.Max > col.Add(iMyArray[ii], iMyArray[ii]) > Next > > iMyArray.Clear() > > For Each ii In col > iMyArray.Add(ii) > Next > > > Jussi > > > 2009/8/21 Benoît Minisini : > >>> N

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Jussi Lahtinen
Meaning like this? Should be faster! Dim col As New Collection For ii = 0 To iMyArray.Max col.Add(iMyArray[ii], iMyArray[ii]) Next iMyArray.Clear() For Each ii In col iMyArray.Add(ii) Next Jussi 2009/8/21 Benoît Minisini : >> Now I use algorithm like this (maybe not optimal); >> >> Dim ii

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Benoît Minisini
> Now I use algorithm like this (maybe not optimal); > > Dim ii As Integer > Dim jj As Integer > Dim bRemove As Boolean > > While ii < iMyArray.Count > > jj = 0 > bRemove = False > While jj < iMyArray.Count > If ii <> jj And iMyArray[ii] = iMyArray[jj] Then > iMyArray.Remove(ii) > bRemove

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Dimitris Anogiatis
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] &= "-b

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Dimitris Anogiatis
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 wrote: > Usually string handling is slower than integer,

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Jussi Lahtinen
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 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 i

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Dimitris Anogiatis
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

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Jussi Lahtinen
Now I use algorithm like this (maybe not optimal); Dim ii As Integer Dim jj As Integer Dim bRemove As Boolean While ii < iMyArray.Count jj = 0 bRemove = False While jj < iMyArray.Count If ii <> jj And iMyArray[ii] = iMyArray[jj] Then iMyArray.Remove(ii) bRemove = True Else Inc jj

Re: [Gambas-user] To the wish list...

2009-08-21 Thread M0E Lnx
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

Re: [Gambas-user] To the wish list...

2009-08-21 Thread Benoît Minisini
> Hi! > Gambas has VERY good set of methods regarding arrays, but something is > missing! I'd like to see iMyArray.RemoveDuplicates. Because with large > arrays this simple task > is pretty CPU intensive! > What do you think? > > > Jussi > Why do you have duplicates inside your array? -- Benoît

Re: [Gambas-user] To the wish list...

2009-08-21 Thread M0E Lnx
Can you use the array.find() method? maybe loop through the array? -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus

[Gambas-user] To the wish list...

2009-08-21 Thread Jussi Lahtinen
Hi! Gambas has VERY good set of methods regarding arrays, but something is missing! I'd like to see iMyArray.RemoveDuplicates. Because with large arrays this simple task is pretty CPU intensive! What do you think? Jussi