Sign in to follow this  
Followers 0
Orca

fast array setting?

8 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
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)

Share this post


Link to post
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)

Share this post


Link to post
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)

Share this post


Link to post
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!!!

Share this post


Link to post
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
Sign in to follow this  
Followers 0