Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Stripping Text From A Field

Posted on 2005-05-05
5
Medium Priority
?
211 Views
Last Modified: 2010-04-06
Hello,

I have a field in access (lets call it txtDetails).  How would i strip the first say 100 characters or words in asp so that is provides a snippet of the whole field?

IE...

<% =StripFirst100Chars(RS("txtDetails")) %>

Thanks,
Carl
0
Comment
Question by:net-workx
5 Comments
 
LVL 15

Assisted Solution

by:joeposter649
joeposter649 earned 200 total points
ID: 13939545
<first say 100 characters>
http://www.w3schools.com/vbscript/func_left.asp

<words >
Split it into an array based on a blank then loop through the array to write out how many words you want.
http://www.w3schools.com/vbscript/func_split.asp

Or do it in your SQL depending on you db...
0
 
LVL 5

Accepted Solution

by:
apparition earned 800 total points
ID: 13939554
<%=Left(RS("txtDetails"),100))%>
0
 
LVL 5

Expert Comment

by:apparition
ID: 13939570
man joeposter649 just got it in a few seconds before me
0
 
LVL 10

Expert Comment

by:m8rix
ID: 13941764
To get the first twenty words (or whatever amount) this code will do that and is more efficiant than looping through an array:

<%
allWords = split(RS("txtDetails"), " ")
REDIM PRESERVE allWords(20)
firstTwenty = join(allWords, " ")
Response.write(firstTwenty)
%>

reg's
m8
0
 

Author Comment

by:net-workx
ID: 13943918
Apparition gave me the exact code i wanted so gets majority of points, but also joe linked to a site with explanations of whats happening so ive split the points.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

805 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question