Modify

Opened 12 years ago

Closed 12 years ago

#2758 closed Bug (Fixed)

_ArrayPermute cannot handle multi-symbol delimiters

Reported by: anonymous Owned by: J-Paul Mesnage
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 by TicketCleanup, 12 years ago

Version: Other

Automatic ticket cleanup.

comment:2 by J-Paul Mesnage, 12 years ago

Milestone: 3.3.13.0
Owner: set to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [10234] in version: 3.3.13.0

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.