473,732 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 22931
Gram wrote:
Hello,

Can anyone tell me if ASP can pass an Array intp a Function?
<nitpick>Presum ably, 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(TheAr ray)
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******@hotma il.com> wrote in message
news:ti******** ********@news.i ndigo.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******@hotma il.com> wrote in message
news:ti******** ********@news.i ndigo.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
3150
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 (count = 0; count <= 1; count++) { if (eval(f.RadioButtons.checked)) { btnChosen = true; }
6
1804
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 can keep everything neat and tidy, And to call the array whenever I want thanks kenny
2
2360
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
7676
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 the bottom of this email)
7
25171
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 (Bubble, insertion, selection..). I have an array of int's and am passing them to each sort function.
5
3421
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? /******************************************************** Below is my code: ********************************************************/
10
9150
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
20405
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 passed also. I understand that this way of passing the array is by value and if the prototype is declared as foo(int *), it is by reference in which case the value if modified in the function will get reflected in the main function as well. I dont...
3
2505
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
3360
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 ways of passing an array. In the following code, fun1(int a1) - same as fun1(int* a1) - where both are of the type passed by reference. Inside this function, another pointer a1 is created whose address &a1 is different from that of the passed...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.