Pulling partial info from a field

Results 1 to 2 of 2

Thread: Pulling partial info from a field

  1. #1
    Jon Guest

    Default Pulling partial info from a field

    I would like to pull only a portion of a paragraph that I have stored in a database field, as opposed to the entire thing. Is there a way to do this?<BR><BR>My purpose here is to diplay a blurb on the homepage for an article. This blurb could be the first 100 characters out of the field where the entire article is contained.

  2. #2
    Join Date
    Dec 1969

    Default A couple of answers...

    The simplest thing to do:<BR>&nbsp; &nbsp; Response.Write Left( RS("theBlurbField"), 100 )<BR><BR>But if you are like me, you&#039;d prefer to cut the paragraph at a word boundary, yes?<BR><BR>So:<BR><BR>&#060;%<BR>txt = RS("theBlurb")<BR>Response.Write Left( txt, InStrRev( txt, " ", 100 ) )<BR>%&#062;<BR><BR>That says: Start at the 100th character and search backwards for a space. Then display everything from the start of the string to that space.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts