Thread overview | |||||
---|---|---|---|---|---|
|
September 21, 2003 Dinamic array remove element | ||||
---|---|---|---|---|
| ||||
How do we remove an element from a dimamic array? slicing? a = a[0..4] ~ a[6..a.length] this works. is this it? Ant |
September 21, 2003 Re: Dinamic array remove element | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ant | "Ant" <Ant_member@pathlink.com> wrote in message news:bkl63u$1d4n$1@digitaldaemon.com... | How do we remove an element from a dimamic array? | | slicing? | | a = a[0..4] ~ a[6..a.length] | | this works. is this it? | | Ant | | No, actually. That should be [0..4]~[5..length] (for the 5th element) or [0..5]~[6..length] (for the 6th). ————————————————————————— Carlos Santander "Ant" <Ant_member@pathlink.com> wrote in message news:bkl63u$1d4n$1@digitaldaemon.com... | How do we remove an element from a dimamic array? | | slicing? | | a = a[0..4] ~ a[6..a.length] | | this works. is this it? | | Ant | | No, actually. That should be [0..4]~[5..length] (for the 5th element) or [0..5]~[6..length] (for the 6th). ————————————————————————— Carlos Santander |
September 21, 2003 Re: Dinamic array remove element | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | In article <bklaf6$1j2s$1@digitaldaemon.com>, Carlos Santander B. says... > >"Ant" <Ant_member@pathlink.com> wrote in message >| a = a[0..4] ~ a[6..a.length] >No, actually. That should be [0..4]~[5..length] (for the 5th element) or I're right. Actually my real code is: listRows = listRows[0..row] ~ listRows[row+1..listRows.length]; And I just changed it to: listRows[row..listRows.length-1] = listRows[row+1..listRows.length]; listRows.length = listRows.length-1; //--(listRows.length); -->> not an lValue. shouldn't it be? is it be more efficient? Ant |
Copyright © 1999-2021 by the D Language Foundation