Print Page | Close Window

Improve Function Split

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=14059
Printed Date: 30 March 2026 at 3:02pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Improve Function Split
Posted By: simoza
Subject: Improve Function Split
Date Posted: 01 March 2005 at 1:43pm
I have created this function that works well:
Function DividiNomeDaWeb(NameLinkTo, PerCosa)


 Dim intSizNomeWeb, intSizNome, intSizWeb


intSizNomeWeb = split(NameLinkTo, PerCosa)

intSizNome = intSizNomeWeb(0)

intSizWeb = intSizNomeWeb(1)
 

DividiNomeDaWeb = "<a href=""http://www."& intSizWeb &""" class=""linksmalltext"">"&intSizNome&"</a>"


End Function
This function split a text in database after a variable "PerCosa".
An example:
In the database i have:siteweb,web.it
 so I call the function in this way:
" & DividiNomeDaWeb (" & DividiNomeDaWeb (objSizRs("Collaboration"), ",") & ", ",") & "

The function split my string in
siteweb and web.it.
 
In case that my objSizRs("Collaboration") is empty, split operation print an error!!!
 
So I would like to put an if that check if my variable is empty and in this case show a message.
 
Like:
Function DividiNomeDaWeb(NameLinkTo, PerCosa)


If NameLinkTo = "" Then

DividiNomeDaWeb = "testo...."

Else

Dim intSizNomeWeb, intSizNome, intSizWeb


intSizNomeWeb = split(NameLinkTo, PerCosa)

intSizNome = intSizNomeWeb(0)

intSizWeb = intSizNomeWeb(1)


DividiNomeDaWeb = "<a href=""http://www."& intSizWeb &""" class=""linksmalltext"">"&intSizNome&"</a>"

End If

End Function
But doesn't work well!!! Why? I don't know how use UBound metodDead
 
 


-------------



Replies:
Posted By: michael
Date Posted: 01 March 2005 at 2:21pm
I'd use
if namelinkto = Nothing
because that is what it is. "" just represents and empty string but is more then nothing.


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: simoza
Date Posted: 01 March 2005 at 2:27pm
The error is:
variable object not set


-------------



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net