473,378 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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.
Jul 19 '05 #1
6 22849
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.
Jul 19 '05 #2
Bob,

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

Gram.
Jul 19 '05 #3
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" <gr******@hotmail.com> wrote in message
news:ti****************@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.

Jul 19 '05 #4
Gram wrote:
Bob,

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


http://mvp.support.microsoft.com/

--
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.
Jul 19 '05 #5
"Gram" <gr******@hotmail.com> wrote in message
news:ti****************@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
Jul 19 '05 #6
Hello,

Thanks for all your quick responses, Got it sorted.

Gram.
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Seeker | last post by:
Newbie question here... I have a form with some radio buttons. To verify that at least one of the buttons was chosen I use the following code ("f" is my form object) : var btnChosen; for...
6
by: Kenny | last post by:
Hello, can anyone tell me how to pass an array to a function ? I have this function , part of my class. It works if I do not put in int a everywhere , but obviously , I need to add an array so I...
2
by: Te-Jung Lo | last post by:
the following is the original code i wrote #include <stdio.h> #include <stdlib.h> //--- Prototype ---// void bfs(int ); void main()
1
by: Mark Dicken | last post by:
Hi All I have found the following Microsoft Technet 'Q' Article :- Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure (I've also copied and pasted the whole contents into...
7
by: ritchie | last post by:
Hi all, I am new to this group and I have question that you may be able to help me with. I am trying to learn C but am currently stuck on this. First of all, I have a function for each sort...
5
by: wilson | last post by:
Dear all, In this time, I want to pass array to function. What should I declare the parameter in the function?i int array or int array? Which one is correct? ...
10
by: nospam | last post by:
Hello! I can pass a "pointer to a double" to a function that accepts double*, like this: int func(double* var) { *var=1.0; ... }
14
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is...
3
by: QQ | last post by:
I have one integer array int A; I need to pass this array into a function and evaluate this array in this function how should I pass? Is it fine? void test(int *a)
11
by: venkatagmail | last post by:
I have problem understanding pass by value and pass by reference and want to how how they are or appear in the memory: I had to get my basics right again. I create an array and try all possible...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.