Jump to content

Displaying The Entire Content Of An Array...


Newbie2
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
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

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