A Curly one coming your way

Results 1 to 2 of 2

Thread: A Curly one coming your way

  1. #1
    Para Guest

    Default A Curly one coming your way

    Hi,<BR><BR>Awhile back someone was kind enuff to help me with a issue regarding, grabbing a memo field data from a database and printing out a set number of words. Now the client wants to upgrade it, as the current script cuts of sentences half way through. They want it to display the first 70 odd words, and still finish at the end of a sentence...................<BR><BR>I don&#039;t know if it can be done, whats your thoughts? <BR>Heres the sample script im currently using<BR><BR><BR>text = RS("content") <BR>words = Split( text, " " ) &#039; split text into words at spaces! <BR>If UBound( words ) &#062; 70 Then <BR> ReDim Preserve words(70) <BR>End If <BR>Response.Write Join( words, " " ) &#039; rejoin no more than 200 words

  2. #2
    RobT Guest

    Default RE: A Curly one coming your way

    You will need to count " ". At least that is my suggestion.<BR>Someone may know a quicker way but here goes.<BR><BR>k = 0<BR>strMemo = ""<BR><BR>For i = 1 to LEN(myMemo)<BR>strMemo = strMemo & MID(myMemo,i,1) <BR><BR>if MID(myMemo,i,1) = " " then<BR>k = k + 1<BR>End IF<BR><BR>If k = 70 then<BR>Exit For<BR>End If<BR>NEXT<BR><BR>response.write strMemo

Posting Permissions

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