Jump to content

Join Arrays


Recommended Posts

Hi,

i have this arrays

$rating_score=_StringBetween($html,"<ratings_score><![CDATA[","]]></ratings_score>")
$rating_users=_StringBetween($html,"<ratings_users><![CDATA[","]]></ratings_users>")
$rating_average=_StringBetween($html,"<ratings_average><![CDATA[","]]></ratings_average>")

How can i join these arrays, so that i can view it (with _ArrayDisplay), each in a own column?

Link to comment
Share on other sites

  • Moderators

Dude,

Like this: :mellow:

#include <String.au3>
#include <Array.au3>

$html = "<ratings_score><![CDATA[score]]></ratings_score><ratings_users><![CDATA[users]]></ratings_users><ratings_average><![CDATA[average]]></ratings_average>"

$rating_score=_StringBetween($html,"<ratings_score><![CDATA[","]]></ratings_score>")
$rating_users=_StringBetween($html,"<ratings_users><![CDATA[","]]></ratings_users>")
$rating_average=_StringBetween($html,"<ratings_average><![CDATA[","]]></ratings_average>")

Global $aArray[1][3] = [[$rating_score[0], $rating_users[0], $rating_average[0]]]

_ArrayDisplay($aArray)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Or little example to show how it could be done:

#include <Array.au3>
Global $a[3] = [1, 2, 3]
Global $b[3] = ['a', 'b', 'c']
$c = _ArrayJoin($a, $b)
_ArrayDisplay($c)

Func _ArrayJoin($first_A, $second_A)
    Local $re[UBound($first_A)][2]
    For $i = 0 To UBound($first_A) - 1
        $re[$i][0] = $first_A[$i]
        $re[$i][1] = $second_A[$i]
    Next
    Return $re
EndFunc ;==>_ArrayJoin

In your case

#include <Array.au3>
Global $a[3] = [1, 2, 3]
Global $b[3] = ['a', 'b', 'c']
Global $c[3] = ['@', '€', '%']
$d = _ArrayJoin($a, $b, $c)
_ArrayDisplay($d)

Func _ArrayJoin($first_A, $second_A, $third_A = 0)
    Local $re[UBound($first_A)][3]
    For $i = 0 To UBound($first_A) - 1
        $re[$i][0] = $first_A[$i]
        $re[$i][1] = $second_A[$i]
        $re[$i][2] = $third_A[$i]
    Next
    Return $re
EndFunc ;==>_ArrayJoin

Mega

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...