Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf

Reply
Thread Tools

A string has no line feeds or cariage retunrs or spaces, need to insert a vbCrLf

 
 
Jason
Guest
Posts: n/a
 
      10-19-2003
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
 
Reply With Quote
 
 
 
 
Adrienne
Guest
Posts: n/a
 
      10-19-2003
Gazing into my crystal ball I observed http://www.velocityreviews.com/forums/(E-Mail Removed) (Jason) writing in
news:(E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
Tom B
Guest
Posts: n/a
 
      10-19-2003
Your script seems to shorten each word to a maximum of 5 characters?

"Adrienne" <(E-Mail Removed)> wrote in message
news:Xns9418F214064EAarbpenyahoocom@207.115.63.158 ...
> Gazing into my crystal ball I observed (E-Mail Removed) (Jason) writing in
> news:(E-Mail Removed) 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



 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      10-19-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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



 
Reply With Quote
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      10-19-2003
http://tinyurl.com/rhyl






"Jason" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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



 
Reply With Quote
 
Bob Lehmann
Guest
Posts: n/a
 
      10-19-2003
I have trouble remembering something that happened last week, and you recall
a thread from over three years ago? :>)

Bob Lehmann

"Aaron Bertrand [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> http://tinyurl.com/rhyl
>
>
>
>
>
>
> "Jason" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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

>
>



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      10-20-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have trouble remembering something that happened last week, and you

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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The method of insert doesn't work with nltk texts: AttributeError: 'ConcatenatedCorpusView' object has no attribute 'insert' Token Type Python 3 09-02-2012 02:12 PM
line feeds in Gridview cells? vbcrlf ? new line? wildman@noclient.net ASP .Net 3 03-06-2008 08:54 PM
Cariage return Ouabaine Java 2 01-17-2008 06:23 PM
? for string, inserting a vbcrlf every N characters, or improving the behavior of MSXML Ken Fine ASP General 1 05-25-2006 01:43 PM
How to display "No Rss feeds new availabe" when there are no FEEDS Patrick Olurotimi Ige ASP .Net 2 05-04-2005 11:50 PM



Advertisments