Modify

Opened 4 years ago

Closed 4 years ago

#2758 closed Bug (Fixed)

_ArrayPermute cannot handle multi-symbol delimiters

Reported by: anonymous Owned by: Jpm
Milestone: 3.3.13.0 Component: Standard UDFs
Version: Other Severity: None
Keywords: Cc:

Description

but actual culprit is internal Array_ExeterInternal()

from Example:

; Declare a 1-dimensional array, return an Array of permutations

#include <Array.au3>

Local $aArray[4] = [1, 2, 3, 4]
Local $aNewArray = _ArrayPermute($aArray, ",,,") ;Using Default Parameters
_ArrayDisplay($aNewArray, "Array Permuted")

proposed change:

Func __Array_ExeterInternal(ByRef $avArray, $iStart, $iSize, $sDelim, ByRef $aIdx, ByRef $aResult, ByRef $iCount)
	If $iStart == $iSize - 1 Then
		For $i = 0 To $iSize - 1
			$aResult[$iCount] &= $avArray[$aIdx[$i]] & $sDelim
		Next
		;If $sDelim <> "" Then $aResult[$iCount] = StringTrimRight($aResult[$iCount], 1) <--------V----------------------------
		If $sDelim <> "" Then $aResult[$iCount] = StringTrimRight($aResult[$iCount], StringLen($sDelim))
		$iCount += 1
	Else
		Local $iTemp
		For $i = $iStart To $iSize - 1
			$iTemp = $aIdx[$i]

			$aIdx[$i] = $aIdx[$iStart]
			$aIdx[$iStart] = $iTemp
			__Array_ExeterInternal($avArray, $iStart + 1, $iSize, $sDelim, $aIdx, $aResult, $iCount)
			$aIdx[$iStart] = $aIdx[$i]
			$aIdx[$i] = $iTemp
		Next
	EndIf
EndFunc   ;==>__Array_ExeterInternal

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by TicketCleanup

  • Version set to Other

Automatic ticket cleanup.

comment:2 Changed 4 years ago by Jpm

  • Milestone set to 3.3.13.0
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [10234] in version: 3.3.13.0

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.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.