http://gambaswiki.org/wiki/comp/gb/string[]/extract says:
[edited-quote]
Function Extract (Start As Integer [, Length As Integer ]) As String[]
If Length is negative, then Length elements counting backwards from the
specified Start are removed.
[/edited-quote]
But this does not appear to be the manner in which it behaves. (I am
also unsure what "counting backwards" means. Would that be toward the
beginning or the end of the array?)
Public Sub Main()
Dim myStrings As String[] = ["s1", "s2", "s3", "s4", "s5", "s6", "s7"]
Dim sString As String
myStrings = myStrings.Extract(2, -1)
Print "Number of extracted elements: " & myStrings.Count
For Each sString In myStrings
Print sString
Next
End
produces:
Number of extracted elements: 5
s3
s4
s5
s6
s7
Obviously, "myStrings.Extract(2, -1)" extracted all elements from the
specified Start to the end of the array, not just one element from the
specified Start.
"myStrings.Extract(2, -2)" gives an "Out of bounds" error.
So, I guess my question should be, what is the intended behavior?
--
Lee
__________
"Artificial Intelligence is no match for natural stupidity."
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user