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

ASP String parsing problem

Status
Not open for further replies.

cyberbob2

Programmer
Nov 13, 2003
32
0
0
US
Hello, I am sending a value from an input form to a database/e-mail processing page which works fine, but I need to parse the value:
TEST,TEST2

What I need to do is before the value even submits, parse out the text before the first comma, along with the comma itself, so I am left with:
TEST2

I've been playing around with string functions but can't seem to get me head around it. If someone could show me how to do it I would sure appreciate it.

Thanks in advance,
CB
 
try this:
Code:
<%
mystring = "TEST,TEST2"
myarray= split(mystring, ",")
response.write myarray(0)
%>

-DNG
 
wonder if the reg object would be more costly in performance than the array in this requirement or vice versa

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
yeah yeah it's implied user knows elements...but just in case :)
<%
mystring = "TEST,TEST2"
myarray= split(mystring, ",")
' myArray(0) = Test
' myArray(1) = Test2
response.write myarray(1)
%>
 
I would imagine someone wouldn't have the ability of using the title "programmer" without knowing simply arrays :)

But I have seen worse in our field

[sub]____________ signature below ______________
The worst mistake you'll ever make is to do something simply the way you know how while ignoring the way it should be done[/sub]
 
meant no offense cb...i was a little concerned you didn't split the simple array to begin with...so i wasn't sure..glad you got it:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top