VB ragged array access

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew

    VB ragged array access

    **** Post for FREE via your newsreader at post.usenet.com ****

    Hi

    This VB script prints out a ragged VB array

    public function display(vbreply )
    For I = LBound(vbreply) To UBound(vbreply)
    param = vbreply(I)
    if isArray(param) then
    For J = LBound(param) To UBound(param)
    WScript.Echo param(J)
    Next
    else
    WScript.Echo param
    end if
    Next
    end function


    How to do the same thing in JavaScript assuming a VB array got obtained
    this way:

    var vbreply = new VBArray(...

    TIA
    Andrew




    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
    Best Usenet Service Providers 2025 ranked by Newsgroup Access Newsservers, Usenet Search, Features & Free Trial. Add VPN for privacy.

    Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  • kaeli

    #2
    Re: VB ragged array access

    In article <40c87ccc$1@pos t.usenet.com>, universalkludge @hotmail.com
    enlightened us with...[color=blue]
    >
    > This VB script prints out a ragged VB array
    >[/color]

    What is this VB you speak of? ;)
    [color=blue]
    > public function display(vbreply )
    > For I = LBound(vbreply) To UBound(vbreply)[/color]

    Arrays in javascript go from 0 to array.length-1.
    From your code and a semi-decent VBScript understanding, it looks like
    you're trying to print the contents of a 2 dimensional array (array of
    arrays) but you verify that it is indeed an array.

    Assuming that is the case...
    (watch for word-wrap)

    function display(vbreply )
    {
    var L1;
    var L2;
    if (vbreply && vbreply.length && vbreply.length > 0)
    {
    L1 = vbreply.length;
    for (var i=0; i<L1; i++)
    {
    if (vbreply[i].length && vbreply[i].length > 0)
    {
    L2 = vbreply[i].length;
    for (var j=0; j<L2; j++)
    {
    document.write( vbreply[i][j]); // change this to write to
    wherever
    }
    }
    else document.write( vbreply[i]);
    }
    }
    else document.write( vbreply);
    }

    --
    --
    ~kaeli~
    The more ridiculous a belief system, the higher probability
    of its success.



    Comment

    Working...