Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a value to function

Status
Not open for further replies.

gooseriver

IS-IT--Management
Aug 4, 2006
93
CA
How can I pass a value to a function using asp?

var1 = "John|Peoples"
Response.write newvar


Function Remove_Comma(var1)
newvar=var1
set rx=new regexp
with rx
.pattern="^/|/$"
.global=true
end with
newvar=rx.replace(newvar,"")
end Function

**I tried this but it did not work...
 
try this:
Code:
<%
var1 = "John|Peoples"
Response.write Remove_Comma(var1)


Function Remove_Comma(var1)
        set rx=new regexp
        with rx
            .pattern="^/|/$"
            .global=true
        end with
    Remove_Comma=rx.replace(var1,"")
end Function

%>

-DNG
 
I tried the following code and had no luck:


var1 = "John,Peoples"
Response.write Remove_Comma(var1)

Function Remove_Comma(var1)
var1=var1
set rx=new regexp
with rx
.pattern="^/|/$"
.global=true
end with
var1=rx.replace(var1,"")
end Function



 
did u try what i suggested...the function name and return value name must be same...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top