Sign in to follow this  
Followers 0
Newbie2

Displaying The Entire Content Of An Array...

4 posts in this topic

#1 ·  Posted (edited)

Hey (again) :whistle:

$NickLength=Random (1,12)
Dim $NameArray [$NickLength]
;Nick loop
For $nickLoop=0 to $NickLength-1
   $myAsciiRandNickChar=Int (Random (20,126))
   $NameArray [$nickLoop] = Chr($myAsciiRandNickChar)
Next
;How to displaye a MsgBox with the antire content of the $NameArray array?

10x (again) B)

Edited by Newbie2

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try

MsgBox(0,"", DisplayArray($NameArray, ","))

Func DisplayArray(ByRef $array, $pad)
  Local $text
  $text = ""
  If not IsArray($array) Then
    SetError(1)
    return $text
  EndIf
  
  Local $i
  For $i = 0 to UBound($array) - 1
    $text = $text & $array[$i] & $pad
  Next
  If StringLen($pad) > 0 Then
    $text = StringTrimRight($text, StringLen($pad))
  EndIf
  return $text
EndFunc
Edited by GrahamS

GrahamS

Share this post


Link to post
Share on other sites

10x Grahams,

It's kind of complicate, though. :whistle:

I thought there is a way to display the content by using something like that:

Msgbox (0,"",$Myarray)

Share this post


Link to post
Share on other sites

10x Grahams,

It's kind of complicate, though.  :whistle:

I thought there is a way to display the content by using something like that:

Msgbox (0,"",$Myarray)

Yep it is kinda complicated, but its written as a UDF so that that you can just cut and paste it wherever you need it B)

And sorry, don't know of any short circuit :angry:


GrahamS

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