Restored from previous forum. Originally posted by Lars.
I miss a Ubound() funktion very much. It should return the number of
indexes in a Array in the specifed Dimension.
THX,
Lars
PS: Sorry for my broken English
(Implemented as 'ArraySize()')
Lars
IF ALL SEEMS PERFECT, CHECK IT AGAIN. TWICE.
[Implemented] UBound(Array() [, Dimension])
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
Dim foo.l(20)
PrintN(Str(UBound(foo)))
then it will print 21.
--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)
It is a Visual Basic command. If you do something like this:Originally posted by GPI
I don't know, what you want.
Make a little example.
Dim foo.l(20)
PrintN(Str(UBound(foo)))
then it will print 21.
--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
As workaround you could code like I do:
This Array has 17 entries - from 0 to 16.
Now for my data I use only 1 to 16, because 0 is used for the number of the possible entries = 16 (from 1 to 16).
This:
would be the equivalent of your UBound command.
If you use your array for loops you have to start at 1 instead of 0.
Have a nice day...
Franco
As workaround you could code like I do:
Code: Select all
Dim Array.l(16)
Array(0) = 16
Now for my data I use only 1 to 16, because 0 is used for the number of the possible entries = 16 (from 1 to 16).
This:
Code: Select all
Result = Array.l(0)
If you use your array for loops you have to start at 1 instead of 0.
Have a nice day...
Franco
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm