Jump to content

Multiply arrays to one


Recommended Posts

Im really stuck with the arrays, i don't know how i can fix multiply arrays to one array.

Like this code, to one array.

#Include <Array.au3>

;{
local $Alpha[26] = ["41 A" ,"42 B" ,"43 C" ,"44 D" ,"45 E" ,"46 F" ,"47 G" ,"48 H" ,"49 I" ,"4A J" ,"4B K" ,"4C L" ,"4D M" ,"4E N" ,"4F O" ,"50 P" ,"51 Q" ,"52 R" ,"53 S" ,"54 T" ,"55 U" ,"56 V" ,"57 W" ,"58 X" ,"59 Y" ,"5A Z"]
local $lAlpha[26] = ["61 a", "62 b", "63 c", "64 d", "65 e", "66 f", "67 g", "68 h", "69 i", "6A j", "6B k", "6C l", "6D m", "6E n", "6F o", "70 p", "71 q", "72 r", "73 s", "74 t", "75 u", "76 v", "77 w", "78 x", "79 y", "7A z"] 
local $Num[19] = ["30 0", "31 1", "32 2", "33 3", "34 4", "35 5", "36 6", "37 7", "38 8", "39 9"]
;}

write to 1 array..

;loop out the whole array.
for $i = 0 to ubound($array,1) -1

consolewrite($array[$i])

next
Edited by cparadis
Link to comment
Share on other sites

Im really stuck with the arrays, i don't know how i can fix multiply arrays to one array.

Like this code, to one array.

#Include <Array.au3>

;{
local $Alpha[26] = ["41 A" ,"42 B" ,"43 C" ,"44 D" ,"45 E" ,"46 F" ,"47 G" ,"48 H" ,"49 I" ,"4A J" ,"4B K" ,"4C L" ,"4D M" ,"4E N" ,"4F O" ,"50 P" ,"51 Q" ,"52 R" ,"53 S" ,"54 T" ,"55 U" ,"56 V" ,"57 W" ,"58 X" ,"59 Y" ,"5A Z"]
local $lAlpha[26] = ["61 a", "62 b", "63 c", "64 d", "65 e", "66 f", "67 g", "68 h", "69 i", "6A j", "6B k", "6C l", "6D m", "6E n", "6F o", "70 p", "71 q", "72 r", "73 s", "74 t", "75 u", "76 v", "77 w", "78 x", "79 y", "7A z"] 
local $Num[19] = ["30 0", "31 1", "32 2", "33 3", "34 4", "35 5", "36 6", "37 7", "38 8", "39 9"]
;}

write to 1 array..

;loop out the whole array.
for $i = 0 to ubound($array,1) -1

consolewrite($array[$i])

next
Look at _ArrayConcatenate in help file.
Link to comment
Share on other sites

Here's an Evil way, erm I mean an Eval way...

#Include <Array.au3> ;only used for _ArrayDisplay()

local $Alpha[26] = ["41 A" ,"42 B" ,"43 C" ,"44 D" ,"45 E" ,"46 F" ,"47 G" ,"48 H" ,"49 I" ,"4A J" ,"4B K" ,"4C L" ,"4D M" ,"4E N" ,"4F O" ,"50 P" ,"51 Q" ,"52 R" ,"53 S" ,"54 T" ,"55 U" ,"56 V" ,"57 W" ,"58 X" ,"59 Y" ,"5A Z"]
local $lAlpha[26] = ["61 a", "62 b", "63 c", "64 d", "65 e", "66 f", "67 g", "68 h", "69 i", "6A j", "6B k", "6C l", "6D m", "6E n", "6F o", "70 p", "71 q", "72 r", "73 s", "74 t", "75 u", "76 v", "77 w", "78 x", "79 y", "7A z"]
local $Num[19] = ["30 0", "31 1", "32 2", "33 3", "34 4", "35 5", "36 6", "37 7", "38 8", "39 9"]

$aAsOne = _OneArray("Alpha|lAlpha|Num", "|")
_ArrayDisplay($aAsOne)

Func _OneArray($sArrays, $Delimiter)
    Local $aRet[1], $aS = StringSplit($sArrays, $Delimiter), $aTmp
    For $i = 1 To $aS[0]
        $aTmp = eval($aS[$i])
        If IsArray($aTmp) Then
            For $j = 0 To Ubound($aTmp) -1
                If $aTmp[$j] <> "" Then
                    $aRet[UBound($aRet)-1] = $aTmp[$j]
                    ReDim $aRet[UBound($aRet)+1]
                EndIf
            Next    
        EndIf
    Next
    If UBound($aRet) > 1 Then ReDim $aRet[UBound($aRet)-1]
    Return $aRet
EndFunc

Edited by smashly
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...