raymurphy
asked on
Removing unwanted characters from string content
Getting some data from database, and need to show it on classic asp web page.
Data coming from database for this particular string will always be in the format :
n - XXXXXXX (numeric, space, hyphen, space followed by text), e.g :
1 - RequiredText
So in the above example, I will be receiving "1 - RequiredText" from the database, but my asp page only needs to show RequiredText.
Any easy ways of doing this, please ?
Data coming from database for this particular string will always be in the format :
n - XXXXXXX (numeric, space, hyphen, space followed by text), e.g :
1 - RequiredText
So in the above example, I will be receiving "1 - RequiredText" from the database, but my asp page only needs to show RequiredText.
Any easy ways of doing this, please ?
I was wrong on that. Wrote it up incorrectly.
Sorry
Sorry
ASKER
The example of "1 - RequiredText" was just an example - what I need to be able to do is strip the text after the numeric-space-hypen-space and then display that text ...
here you go (tested and works)
=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-
<%
myVar = (objRS("Field1"))
If myVar <> "" Then
%>
<%=Replace(myVar,"1 -","") %>
<%
End If
%>
=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-
Carrzkiss
=-=-=-=-=-=-=-=-=-=-=-=-=-
<%
myVar = (objRS("Field1"))
If myVar <> "" Then
%>
<%=Replace(myVar,"1 -","") %>
<%
End If
%>
=-=-=-=-=-=-=-=-=-=-=-=-=-
Carrzkiss
sorry, did not refesh the page before posting.
Let me do some more checking.
Carrzkiss
Let me do some more checking.
Carrzkiss
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for this suggestion, Carrzkiss - I'll give it a go and let you know the outcome ...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the delay in getting back - both solutions worked fine, so I'm going to split accordingly and hop that's OK with you both. Thanks for the solutions - much appreciated.
<%=replace(rs("MyRecord,"1
Carrzkiss