Moin
Da heute morgen jemand eine Funktion 2DArraytoString brauchte hab ich mal schnell eine gemacht.
Ich hab in der ArrayMore UDF von BugFix gekuckt und da war keine drinn(vllt alte version)
Naja auf jeden fall hier ist sie und @ BugFix fals die dir gefällt und soch eine noch nicht in deiner UDF ist kannst die ja mit reinnehemen
Spoiler anzeigen
;====================================================================================================================================================================
; Function.......: _2DArrayToString(ByRef Const $avArray, [$sReturnMode = 0, [$s_D1_Delim = "|", [$iStart = 0, [$iEnd = 0, [$s_D2_Delim = "|"]]]]])
; Description....: Places the elements of an array into a single string, separated by the specified delimiter.
; Parameters ....: $avArray - Array to combine
; $sReturnMode - [optional] Mode to return the String [0]Row 0(Col 0 ,Col 1),Row 1(Col 0,Col 1),Row ..(Col 0,Col 1)
; [1]Row 0(Col 0),Row 1(Col 0),Row ..(Col 0) , Row 0(Col 1),Row 1(Col 1),Row ..(Col 1)
; $s_D1_Delim - [optional] Delimiter for combined string[D1]
; $iStart - [optional] Index of array to start combining at
; $iEnd - [optional] Index of array to stop combining at
; $s_D1_Delim - [optional] Delimiter for combined string[D2]
; Return values .: Success - string which combined selected elements separated by the delimiter string.
; Failure - "", sets @error:
; |1 - $avArray is not an array
; |2 - $iStart is greater than $iEnd
; |3 - $avArray is not an 2 dimensional array
; |4 - $sReturnMode is incorrectly
; Author ........: Darter
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........: http://www.Autoit.com
; Example .......: -
;====================================================================================================================================================================
Func _2DArrayToString(ByRef Const $avArray, $sReturnMode = 0, $s_D1_Delim = "|", $iStart = 0, $iEnd = 0, $s_D2_Delim = "|")
If Not IsArray($avArray) Then Return SetError(1, 0, "")
If UBound($avArray, 0) <> 2 Then Return SetError(3, 0, "")
If $sReturnMode > 1 Then Return SetError(4, 0, "")
Local $sResult, $iUbound = UBound($avArray,1)-1
[/autoit] [autoit][/autoit] [autoit]If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound
If $iStart < 0 Then $iStart = 0
If $iStart > $iEnd Then Return SetError(2, 0, "")
If $sReturnMode = 0 Then
For $i = $iStart To $iEnd
$sResult &= $avArray[$i][0] & $s_D2_Delim & $avArray[$i][1] & $s_D1_Delim
Next
$sResult = StringTrimRight($sResult, StringLen($s_D1_Delim))
Else
For $i = $iStart To $iEnd
$sResult &= $avArray[$i][0] & $s_D1_Delim
Next
$sResult = StringTrimRight($sResult, StringLen($s_D1_Delim)) & $s_D2_Delim
For $i = $iStart To $iEnd
$sResult &= $avArray[$i][1] & $s_D1_Delim
Next
EndIf
Return StringTrimRight($sResult, StringLen($s_D1_Delim))
EndFunc
mfg Darter