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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

split why does it hate me?

Status
Not open for further replies.

lordhuh

Programmer
Apr 25, 2000
96
US
This is the entire chuck of my code. (well really there was alot more but after alot of debuging i boiled it down to this).
Code:
<%
const str1=&quot;hello every body how are you today&quot;
const str2=&quot; &quot;
dim str3
str3=split(str1,str2)
response.write str3
%>

I always get this error message

Error Type:
Response object, ASP 0106 (0x80020005)
An unhandled data type was encountered.
/test.asp


also i have tryed this
Code:
<%
const str1=&quot;hello every body how are you today&quot;
const str2=&quot; &quot;
dim str3()
str3=split(str1,str2)
response.write str3
%>

gets me

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/test.asp, line 5

Code:
<%
const str1=&quot;hello every body how are you today&quot;
const str2=&quot; &quot;
dim str3()
str3()=split(str1,str2)
response.write str3
%>

gets me

Error Type:
Microsoft VBScript runtime (0x800A0009)
Subscript out of range
/test.asp, line 5

Please Im about to give up on asp all together. What is the correct way to do a split Karl Pietri
lordhuh.pota.to

 
lordhuh,
sinse function split()returns an array of strings, you cannot just use [red]response.write str3[/red].
You have to iterrate through the items in array:


<%
dim str1,str3,i
str1=&quot;hello every body how are you today&quot;
str3=split(str1,&quot; &quot;)
for i = 0 to ubound(str3)
response.write str3(i)& &quot;<br>&quot;
next
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top