Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf (http://www.velocityreviews.com/forums/t791065-a-string-has-no-line-feeds-or-cariage-retunrs-or-spaces-need-to-insert-a-vbcrlf.html)

Jason 10-19-2003 06:05 AM

A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
When users fill out my text area field, there is a chance that there
will be no line feeds or cariage returns or spaces and just one really
long word. THIS CAUSES A MAJOR PROBLEM! What I am trying to do is
force a vbCrLf if a string is long than 80 characters in a row. So if
a string is a total of 500 characters with no line feeds, spaces, or
returns, I want to force a vbCrLf every 80 characters so that is
doesn't overflow my preview text field on the next page.

Any suggestions on how the algorithm would be for this in VBscript
ASP?

Thanks,
Jason

Adrienne 10-19-2003 06:49 AM

Re: A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
Gazing into my crystal ball I observed alihamed@msn.com (Jason) writing in
news:ce214430.0310182205.10363d4e@posting.google.c om:

> When users fill out my text area field, there is a chance that there
> will be no line feeds or cariage returns or spaces and just one really
> long word. THIS CAUSES A MAJOR PROBLEM! What I am trying to do is
> force a vbCrLf if a string is long than 80 characters in a row. So if
> a string is a total of 500 characters with no line feeds, spaces, or
> returns, I want to force a vbCrLf every 80 characters so that is
> doesn't overflow my preview text field on the next page.
>
> Any suggestions on how the algorithm would be for this in VBscript
> ASP?
>
> Thanks,
> Jason
>


How about:
for each word in split(request.form("test")," ")
if len(trim(word)) > 5 then
test = test & left(word,5) & vbcrlf & right(word,len(word)-5) & " "
else
test = test & word & " "
end if
next

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com

Tom B 10-19-2003 01:01 PM

Re: A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
Your script seems to shorten each word to a maximum of 5 characters?

"Adrienne" <arbpen2003@sbcglobal.net> wrote in message
news:Xns9418F214064EAarbpenyahoocom@207.115.63.158 ...
> Gazing into my crystal ball I observed alihamed@msn.com (Jason) writing in
> news:ce214430.0310182205.10363d4e@posting.google.c om:
>
> > When users fill out my text area field, there is a chance that there
> > will be no line feeds or cariage returns or spaces and just one really
> > long word. THIS CAUSES A MAJOR PROBLEM! What I am trying to do is
> > force a vbCrLf if a string is long than 80 characters in a row. So if
> > a string is a total of 500 characters with no line feeds, spaces, or
> > returns, I want to force a vbCrLf every 80 characters so that is
> > doesn't overflow my preview text field on the next page.
> >
> > Any suggestions on how the algorithm would be for this in VBscript
> > ASP?
> >
> > Thanks,
> > Jason
> >

>
> How about:
> for each word in split(request.form("test")," ")
> if len(trim(word)) > 5 then
> test = test & left(word,5) & vbcrlf & right(word,len(word)-5) & " "
> else
> test = test & word & " "
> end if
> next
>
> --
> Adrienne Boswell
> Please respond to the group so others can share
> http://www.arbpen.com




Tom B 10-19-2003 01:04 PM

Re: A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
Dim iLoop
Dim sWorking
Dim sSection
for iLoop = 0 to len(theString) step 80
sSection=mid(theString,iLoop,80)
if instr(sSection," ") = 0 OR instr(sSection,vbCrLf)=0 then
sWorking=sWorking & sSection & vbCrLf
else
sWorking=sWorking & sSection
end if
next

"Jason" <alihamed@msn.com> wrote in message
news:ce214430.0310182205.10363d4e@posting.google.c om...
> When users fill out my text area field, there is a chance that there
> will be no line feeds or cariage returns or spaces and just one really
> long word. THIS CAUSES A MAJOR PROBLEM! What I am trying to do is
> force a vbCrLf if a string is long than 80 characters in a row. So if
> a string is a total of 500 characters with no line feeds, spaces, or
> returns, I want to force a vbCrLf every 80 characters so that is
> doesn't overflow my preview text field on the next page.
>
> Any suggestions on how the algorithm would be for this in VBscript
> ASP?
>
> Thanks,
> Jason




Aaron Bertrand [MVP] 10-19-2003 05:04 PM

Re: A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
http://tinyurl.com/rhyl






"Jason" <alihamed@msn.com> wrote in message
news:ce214430.0310182205.10363d4e@posting.google.c om...
> When users fill out my text area field, there is a chance that there
> will be no line feeds or cariage returns or spaces and just one really
> long word. THIS CAUSES A MAJOR PROBLEM! What I am trying to do is
> force a vbCrLf if a string is long than 80 characters in a row. So if
> a string is a total of 500 characters with no line feeds, spaces, or
> returns, I want to force a vbCrLf every 80 characters so that is
> doesn't overflow my preview text field on the next page.
>
> Any suggestions on how the algorithm would be for this in VBscript
> ASP?
>
> Thanks,
> Jason




Bob Lehmann 10-19-2003 08:10 PM

Re: A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
I have trouble remembering something that happened last week, and you recall
a thread from over three years ago? :>)

Bob Lehmann

"Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
news:uyj3hMmlDHA.2404@TK2MSFTNGP12.phx.gbl...
> http://tinyurl.com/rhyl
>
>
>
>
>
>
> "Jason" <alihamed@msn.com> wrote in message
> news:ce214430.0310182205.10363d4e@posting.google.c om...
> > When users fill out my text area field, there is a chance that there
> > will be no line feeds or cariage returns or spaces and just one really
> > long word. THIS CAUSES A MAJOR PROBLEM! What I am trying to do is
> > force a vbCrLf if a string is long than 80 characters in a row. So if
> > a string is a total of 500 characters with no line feeds, spaces, or
> > returns, I want to force a vbCrLf every 80 characters so that is
> > doesn't overflow my preview text field on the next page.
> >
> > Any suggestions on how the algorithm would be for this in VBscript
> > ASP?
> >
> > Thanks,
> > Jason

>
>




Aaron Bertrand - MVP 10-20-2003 01:06 PM

Re: A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf
 
I vaguely recalled dealing with the situation before (and was surprised I
hadn't entered an article about it). Though you can easily force carriage
returns by placing text within a fixed-width table or div.

It took me about 20 minutes to find that thread, because of my initial
choice of keywords...




"Bob Lehmann" <nospam@dontbotherme.zzz> wrote in message
news:ujuEvxnlDHA.3288@tk2msftngp13.phx.gbl...
> I have trouble remembering something that happened last week, and you

recall
> a thread from over three years ago? :>)





All times are GMT. The time now is 06:38 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.