AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Jeff Allen
Expertise
I can answer basic to intermediate questions related to Classic ASP.I can answer Intermediate to Advanced questions CSS& HTML, and basic questions about JavaScript and Ajax. I can also answer questions related to web page accessibility under US Section 508.

Experience
I have 8 years experience with HTML. I have been developing in ASP, VBScript and CSS for two years each. I also currently work as web developer.

Organizations
IWA-HWG

Education/Credentials
I have a BA in English with minors in Web Design and Scientific and Technical Writing

 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > Trim text in DB when displaying as HTML

Topic: Active Server Pages Programming (ASP)



Expert: Jeff Allen
Date: 7/17/2006
Subject: Trim text in DB when displaying as HTML

Question
Hi,
I use ASP to scrape the contents of a webpage and store it in a database(the source site only updates once a week so to avoid lumbering them with requests I store it locally, and only update once a week). The asp script i have checks the dates and if an update is required it goes off and fetches it and stores it, if not, it creates a recordset and displays the latest info in the DataBase.

This all works fine, but when it stores the html content it also stores a lot of tables and frames from the original site which i dont use.

Is there a way with ASP to display information between two known delimiters? for instance:

In the text "I am a happy person" if I set "am" as start and "person" as end to display "a happy"

Long question for a (probably) easy task

Grateful for any help  

Answer
Yeah to do this you would use the MID function in ASP.

So, using your example, if you knew the starting position of what you wanted to grab, and the length of the string you wanted to grab you could do it this way:

<%
 Dim myString : myString = "I am a happy person"
 Dim storedString = Mid(myString, 5,7)
%>

Then the value of storedString would be "a happy"

For more neat string editing functions Check out the examples in the See Also section here: http://www.devguru.com/technologies/vbscript/13951.asp

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.