Modify ↓
Opened 11 years ago
Closed 11 years ago
#2564 closed Feature Request (Rejected)
UDF - _ArrayInsert - proposal
Reported by: | mlipok | Owned by: | |
---|---|---|---|
Milestone: | Component: | Standard UDFs | |
Version: | Severity: | None | |
Keywords: | Cc: |
Description
now is
Func _ArrayInsert(ByRef $avArray, $iElement, $vValue = "") If Not IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(2, 0, 0) ; Check element in array bounds + 1 If $iElement > UBound($avArray) Then Return SetError(3, 0, 0) ; Add 1 to the array Local $iUBound = UBound($avArray) + 1 ReDim $avArray[$iUBound] ; Move all entries over til the specified element For $i = $iUBound - 1 To $iElement + 1 Step -1 $avArray[$i] = $avArray[$i - 1] Next ; Add the value in the specified element $avArray[$iElement] = $vValue Return $iUBound EndFunc ;==>_ArrayInsert
proposal:
change:
; Check element in array bounds + 1 If $iElement > UBound($avArray) Then Return SetError(3, 0, 0) ; Add 1 to the array Local $iUBound = UBound($avArray) + 1 ReDim $avArray[$iUBound]
to
; Check element in array bounds + 1 Local $iUBound = UBound($avArray) If $iElement > $iUBound Then Return SetError(3, 0, 0) ; Add 1 to the array $iUBound += 1 ReDim $avArray[$iUBound]
because:
small clarification
and faster (only once uses the UBound($avArray) )
Attachments (0)
Change History (3)
comment:1 Changed 11 years ago by TicketCleanup
- Version Other deleted
comment:2 Changed 11 years ago by BrewManNH
How much faster is it doing it that way?
comment:3 Changed 11 years ago by Jos
- Resolution set to Rejected
- Status changed from new to closed
Closing as rejected.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.
Automatic ticket cleanup.