Show Limited Text
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=18649
Printed Date: 29 March 2026 at 7:00pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Show Limited Text
Posted By: __n3o__
Subject: Show Limited Text
Date Posted: 08 March 2006 at 3:43pm
... Need a clever person to point me in the right direction 
I am collecting some content from a DB field, but only want to show the first 15 words of what ever is in there.. Like a mini preview
I thought I could use the Trim function, but am I right in thinking this only takes out spaces? If anyone could tell me what I should be using it would be appreciated 
Thanks
|
Replies:
Posted By: michael
Date Posted: 08 March 2006 at 8:18pm
15 first words is a little more tricky. 15 first characters is easy as you could juse use Repsonse.Write(left(dbfield,15))
Now, 15 words you can put them into an array, use 14 members count up and spit them out, there are other ways of doing that too but for simplicity I would stick with characters rounding up to the next whitespace.
------------- http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker
|
Posted By: ljamal
Date Posted: 08 March 2006 at 9:04pm
With 15 words, I would select the first 200 or so characters via SQL and then using VBScript to strip it down to the first 15 words.
------------- L. Jamal Walton
http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming
|
Posted By: __n3o__
Date Posted: 09 March 2006 at 8:21am
Thanks chaps... 
Micheal thats perfect dude... 
|
|