Can ASP pass an Array into a Function?

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Can ASP pass an Array into a Function?

    Hello,

    Can anyone tell me if ASP can pass an Array intp a Function? If so, can
    anyone point me to an example?

    Thanks in advance.

    Gram.


    Gram Guest

  2. Similar Questions and Discussions

    1. How to pass array of sting to non-CF web service?
      My co-worker develops a Java web service which takes an array of user IDs and return the email addresses for those IDs. However, I just can't...
    2. How do you pass an array of structures to webservice?
      Hello, Does anyone have an example of how to pass an array of strings (ie purchase Id's) from CF to a web service (like weblogic), and then...
    3. CFC array pass a URL?
      Can you pass a hyperlink as a varaible in an array using CFC and Flash? In other words, I am trying to pass a hyperlink from a CFC to Flash using...
    4. how to pass multi array as args
      Can someone show me how to pass multiple arrays argument? ie - .... mysub(@a, @b, @c); .... sub mysub { my @a = ? #arg1 an array $_ is...
    5. How to pass array values to ASP part
      Any values that exist in the client have to be sent back to the server by submitting a form, refreshing a page with a querystring, or some other...
  3. #2

    Default Re: Can ASP pass an Array into a Function?

    Gram wrote:
    > Hello,
    >
    > Can anyone tell me if ASP can pass an Array intp a Function?
    <nitpick>Presumably, you mean: "can vbscript pass an array into a
    function?". ASP is not a language: it is a platform which supports several
    scripting languages, including vbscript, jscript, javascript ...</nitpick>
    > If so,
    > can anyone point me to an example?
    >
    Sure.
    <%option explicit
    'create the function:
    function UseArray(pAr)
    dim i
    response.write "The array contains the following elements:<BR>"
    for i = 0 to ubound(pAr)
    response.write pAr(i) & "<BR>"
    next
    UseArray = join(pAr,"; ")
    end function

    'create the array
    dim ar, s
    ar=array(1,2,3)
    'pass it to the function:
    s = UseArray(ar)
    response.write "<BR>The function returned this string:<BR>"
    response.write s
    %>

    --
    HTH,
    Bob Barrows - ASP MVP
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows Guest

  4. #3

    Default Re: Can ASP pass an Array into a Function?

    Sure.

    a = Array("a","b","c")
    AA = MakeItBig(a)
    Response.Write Join(AA, " - ")

    Function MakeItBig(TheArray)
    Dim aResult()
    Redim aResult(UBound(TheArray))
    For i = 0 To UBound(TheArray)
    aResult(i) = UCase(TheArray(i))
    Next
    MakeItBig = aResult
    End Function

    That function will take the contents of an array and capitalize the values
    and return it.

    Ray at work

    "Gram" <gram3000@hotmail.com> wrote in message
    news:tixjb.1264$bD.4444@news.indigo.ie...
    > Hello,
    >
    > Can anyone tell me if ASP can pass an Array intp a Function? If so, can
    > anyone point me to an example?
    >
    > Thanks in advance.
    >
    > Gram.
    >
    >

    Ray at Guest

  5. #4

    Default Re: Can ASP pass an Array into a Function?

    Gram wrote:
    > Bob,
    >
    > Thanks for the help and the quick reply.
    > What does ASP MVP stand for?
    >
    [url]http://mvp.support.microsoft.com/[/url]

    --
    HTH,
    Bob Barrows - ASP MVP
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows Guest

  6. #5

    Default Re: Can ASP pass an Array into a Function?

    Bob,

    Thanks for the help and the quick reply.
    What does ASP MVP stand for?

    Gram.


    Gram Guest

  7. #6

    Default Re: Can ASP pass an Array into a Function?

    "Gram" <gram3000@hotmail.com> wrote in message
    news:tixjb.1264$bD.4444@news.indigo.ie...
    > Hello,
    >
    > Can anyone tell me if ASP can pass an Array intp a Function? If so, can
    > anyone point me to an example?
    <%
    Function arrToStr( myarray )
    Dim i, result

    For i = LBound(myarray) To UBound(myarray)
    result = result & myarray(i)
    Next
    arrToStr = result
    End Function

    x = array("A","B","C")
    Response.Write( arrToStr(x) )
    %>

    Hope this helps. :)
    Regards,
    Peter Foti


    Peter Foti Guest

  8. #7

    Default Re: Can ASP pass an Array into a Function?

    Hello,

    Thanks for all your quick responses, Got it sorted.

    Gram.


    Gram Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139