[Gambas-user] Array query

Fabien Bodard gambas.fr at ...626...
Sun Jan 6 15:01:01 CET 2008


Le Sunday 06 January 2008 14:11:30 lozza1978, vous avez écrit :
> Hi Fabien & all,
>
> Thanks for your help, im pleased to say that the progress bar is now
> showing correctly ,javascript:Nabble.smiley('smiley_good.gif','=)')
>
> Can you please explain how it works?, I dont really understand whats going
> on and would really like to grasp it.
>
>  scanning for the string[]
> aString = Scan(sLine, "Pos: *s *f (*%) *fps*")
>
> This is what I dont understand? aString will allways be more than 2,
> if aString.Count > 2 then
>
> 1, when I print aString[2] it prints some type of memory address i guess?,
> 2,what is aString[2] i know its an array but whats the 2 for?
> 3 what value/element are you using in aString to divide by 100 to get
> progress
>
> ProgressBar1.Value = Val(aString[2])/100
>
> Thanks again for your help

You are really a beginner... but you're lucky ... i've 2 minutes for you :-P

I see you have understand arrays.. a good point for me :)

Scan is a magic gambas function that return items of a string in function of a 
pattern string

the pattern can have letters contained in  the string, spaces (that represent 
one or more spaces or tabs), and all the LIKE meta keys

The * symbole is replaced by the string that is at the same position in the 
matched string

For exemple

aString = scan("Hello lozza how are you today", "Hello * how are you *")
Print aString[0]
=>lozza
Print aString[1]
=>today

Nothing hard ... no?

when i've the problem with the % :

when <10 => it use ( 9%)
when >10 => it use (11%)

a space but only when <9 so the pattern ( *%) can work only in the case <10

why test the count of the array and why 2..

2 is just a number i can say >1 too, the goal is to test if scan have returned 
something, If the sline is not the same to tis one i match, the array count 
will be =  0

why divide /100 ? if you look the result of your process the value of the 
progress is between 0 to 100, a prgressbar value is between 0 to 1...










More information about the User mailing list