View Full Version : Restricting the length of results string
Bobn
10-06-2003, 05:01/05:01AM
Hi All,
I am trying to get a set of results that have restricted lengths
say I have an entry with 4000 char. in and I wish to get a limited result of say 200 char. from the entry for say a description within a listing of results page....
How do I do this without touching the database(a query/view)[no access to data]
Regards to all
:D
polarmate
10-06-2003, 11:16/11:16AM
Hey Bobn
Try using the mid function.
mid(textstring, start, numofchars)
eg
s200charrslt = mid(s400chartxt, 1, 200)
http://msdn.microsoft.com is a good resource to use.
Hope this helps!
Bobn
18-06-2003, 03:41/03:41AM
confused and perplexed(again)
ref message from polarmate
------------------------------------------------------------
Hey Bobn
Try using the mid function.
mid(textstring, start, numofchars)
eg
s200charrslt = mid(s400chartxt, 1, 200)
http://msdn.microsoft.com is a good resource to use.
Hope this helps!
------------------------------------------------------------------
without sounding like a moron ----how do you apply this to a page ,derrr -I'm trying but its not as easy as it seems derrr-
But seriously I can see the idea behind the script and how it works but I can't get it to run ....
Had a look at http://msdn.microsoft.com some good stuff but as with all MS stuff its trying to be to much of all things and ends up being to little of anything....
regards and thanks :D
chrishirst
18-06-2003, 10:18/10:18AM
Post some code that creates the string you want to slice up
ASP Technical Forum at www.tek-tips.com as well.
Chris.
polarmate
18-06-2003, 11:55/11:55AM
Hey Bobn,
The mid function extracts a string of a specified length from another string. Both strings need to be available in a variable.
If it's a 'page' or a file from which you are trying to extract the text, then you need to access the file using the FileScriptingObject and read its contents into a variable and then extract what you want to. If you want to extract from HTML files then your starting point has to be after the body tag.
If you describe more of what you are trying to do then I could help you further.
Bobn
19-06-2003, 03:27/03:27AM
nice one polarmate
I get it now....
Place the record set item on the page and make a var value out of the database enty the cut the length of the resulting text down (virtually) with the md funct. in the place that I wantthe text to show...
another quick thing ...do you'll no anything about xml/rss files?
cheers all :cheers:
polarmate
19-06-2003, 10:33/10:33AM
Kal and Dan0 wrote an article on RSS in Dec 2002
How To Get Your Web Site Content Syndicated (http://www.searchengineguide.com/kalena/2002/1220_kj1.html)
It's a great article!
Bobn
20-06-2003, 04:02/04:02AM
Yeah Nice one Polarmate
Good stuff-:cheers:
I didn't think that making my own rss newsfeeds would be so simple....
Nuff respect to Kal and Dan0....
Regards
Bob
polarmate
20-06-2003, 10:58/10:58AM
Yup! We've got the best of the best here!
:cheers:
vBulletin® v3.8.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.