Jump to content

fast array setting?


Orca
 Share

Recommended Posts

k i rarly ever use autoit, and dispise how i have to set arrays (prolly doin it nOOb style :()

Dim $X_Array[7]
$X_Array[1] = 84
$X_Array[2] = 122
$X_Array[3] = 164
$X_Array[4] = 205
$X_Array[5] = 246
$X_Array[6] = 287

is there a way to set each value more like in php

//Setting arrays in php
$variable = array('val1', 'val2', 'val3');

i super need a faster way because ill be settings arrays like super long and this would == " :ph34r: "

- [G]oat | Kurusuki

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

  • Developers

k i rarly ever use autoit, and dispise how i have to set arrays (prolly doin it nOOb style :ph34r:)

//Setting arrays in php
$variable = array('val1', 'val2', 'val3');

<{POST_SNAPBACK}>

//Setting arrays in php
$variable = StringSplit("val1, val2,val3",",");
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

super thanks so much, i understand how it works and returns vars, but could you explain the purpose of the "," at the end? i dont understand what it means in the HelpFile explination

Edited by SiC_Goat

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

The "," at the end indicates what separator character to use....

Alternatives:

StringSplit("val1/val2/val3", "/");

StringSplit("val1Xval2Xval3", "X");

<{POST_SNAPBACK}>

I like "|" since it can't be used in filepaths...

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

I like @cr since it can't be used in single line strings. And often it is not even used in more than one lines strings.

Also {tab} is good, since it does not need concatenating.

$eg = StringSplit('one{tab}two{tab}three{tab}four{tab}five','{tab}')

While @cr needs:

$eg2 = StringSplit('six' & @cr & 'seven' & @cr & 'eight' & @cr & 'nine',@cr)

Link to comment
Share on other sites

I like @cr since it can't be used in single line strings. And often it is not even used in more than one lines strings.

Also {tab} is good, since it does not need concatenating.

$eg = StringSplit('one{tab}two{tab}three{tab}four{tab}five','{tab}')

While @cr needs:

$eg2 = StringSplit('six' & @cr & 'seven' & @cr & 'eight' & @cr & 'nine',@cr)

<{POST_SNAPBACK}>

Good points, thanks for the tip.

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

OHHHHHHHHH! Now i get it, the "," at the end just declares what in the first part will be the thing seperating each var, in php each var is sepereated by a comma only...

- [G]oat | Kurusuki

I AM ORCA!! A VERY POWERFUL WHALE!!!

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