Sign in to follow this  
Followers 0
Aceguy

dim $array[$variable] not possible

8 posts in this topic

#1 ·  Posted (edited)

is this possible, if so, how. please

$num=11
dim $var[$num]

because i have an array say $array[100]

based on a search, i never know what elelments i need to delete.

e.g.

i may need to delete elements 1 to 4 and elements 86 to 100

These elements are not the same everytime.?

$i_start=4 and $i_end=86

so ill need to delete elements 1-4 and 86-100

how could i reconstruct this array with the above elements deleted.?

Edited by Aceguy

Share this post


Link to post
Share on other sites



Didn't you answer your own question?

$a=10
dim $b[$a]
$b[0]="hi"
$b[9]="bye"
MsgBox(0,"",$b[0]&":"&$b[9])

Share this post


Link to post
Share on other sites

is this possible, if so, how. please

$num=11
dim $var[$num]oÝ÷ Ûú®¢×­êÞÁ«'¢Øb+¢x0Ør¢êÎ=«­¢+ØÀÌØí¹Õ´ôÄÄ)¥´ÀÌØíÙÉlÀÌØí¹Õµt)¥´ÀÌØí½Õ¹Ð()½ÈÀÌØíàôÄQ¼U    ½Õ¹ ÀÌØíÙȤ´Ä($ÀÌØí½Õ¹Ð¬ôÄ)9áÐ()5Í    ½à ÐÀäØ°ÅÕ½Ðí½Õ¹ÐÅÕ½Ðì°ÀÌØí½Õ¹Ð¤

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You changed your question after you posted... -_-

As for your second question, what about _ArrayDelete() in the Array.au3 UDF.

Edited by evilertoaster

Share this post


Link to post
Share on other sites

Someone probably wrote something like this before... maybe you're after this sort of thing-

dim $example[10]
$example[0]="The "
$example[1]="quick "
$example[2]="brown "
$example[3]="fox "
$example[4]="jumped "
$example[5]="over "
$example[6]="the "
$example[7]="lazy "
$example[8]="dog"
$example[9]="."

$newArray=_ArrayMid($example,3,5) ;return only the 5 elemnts after (and including) the 3rd
for $n=0 to UBound($newArray)-1
    MsgBox(0,"",$newArray[$n])
next

func _ArrayMid(ByRef $inArray,$start,$count=-1)
        if $count=-1 then $count=UBound($inArray)-$start
        dim $tempArray[$count]
        for $i=0 to $count-1
            $tempArray[$i]=$inArray[$start+$i]
        Next
        Return $tempArray
EndFunc

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