473,808 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 19 '05 #1
7 3263
Gazing into my crystal ball I observed al******@msn.co m (Jason) writing in
news:ce******** *************** ***@posting.goo gle.com:
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.f orm("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
Jul 19 '05 #2
Your script seems to shorten each word to a maximum of 5 characters?

"Adrienne" <ar********@sbc global.net> wrote in message
news:Xn******** *************** *****@207.115.6 3.158...
Gazing into my crystal ball I observed al******@msn.co m (Jason) writing in
news:ce******** *************** ***@posting.goo gle.com:
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.f orm("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

Jul 19 '05 #3
Dim iLoop
Dim sWorking
Dim sSection
for iLoop = 0 to len(theString) step 80
sSection=mid(th eString,iLoop,8 0)
if instr(sSection, " ") = 0 OR instr(sSection, vbCrLf)=0 then
sWorking=sWorki ng & sSection & vbCrLf
else
sWorking=sWorki ng & sSection
end if
next

"Jason" <al******@msn.c om> wrote in message
news:ce******** *************** ***@posting.goo gle.com...
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

Jul 19 '05 #4
http://tinyurl.com/rhyl


"Jason" <al******@msn.c om> wrote in message
news:ce******** *************** ***@posting.goo gle.com...
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

Jul 19 '05 #5
Gazing into my crystal ball I observed "Tom B"
<sh*****@NOSPAM hotmail.com> writing in
news:#u******** ******@TK2MSFTN GP10.phx.gbl:

"Adrienne" <ar********@sbc global.net> wrote in message
news:Xn******** *************** *****@207.115.6 3.158...
Gazing into my crystal ball I observed al******@msn.co m (Jason)
writing in news:ce******** *************** ***@posting.goo gle.com:
> 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.f orm("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

Your script seems to shorten each word to a maximum of 5 characters?

Just for testing. It's a little easier to test with 5 characters than 80.
YMMV.

--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com
Jul 19 '05 #6
I have trouble remembering something that happened last week, and you recall
a thread from over three years ago? :>)

Bob Lehmann

"Aaron Bertrand [MVP]" <aa***@TRASHasp faq.com> wrote in message
news:uy******** ******@TK2MSFTN GP12.phx.gbl...
http://tinyurl.com/rhyl


"Jason" <al******@msn.c om> wrote in message
news:ce******** *************** ***@posting.goo gle.com...
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


Jul 19 '05 #7
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" <no****@dontbot herme.zzz> wrote in message
news:uj******** ******@tk2msftn gp13.phx.gbl...
I have trouble remembering something that happened last week, and you recall a thread from over three years ago? :>)

Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2196
by: Paul | last post by:
Hi Doing my best to understand why I cant insert a vbcrlf or an equivalent into this piece of code that read messages from an SQL DB. The messages it takes read into a marquee fine but I want the Marquee to scroll up instead of horizontally and I need new line spacings else the mesages are difficult to read. At present we use the strNewTextDelimitor and I am unable due to syntax or perhaps idioscy to find a way of adding the VBCRLF...
4
431
by: Niyazi | last post by:
Hi I am trying to insert some value into SQL Server 2000 tables and I am keep getting the "Input string was not in a correct format" error. When user fills the Form it updates the table call tbl_04_Hellenic. Then In that form some of data also goes and fills another table call tbl_LEHTAR. Here is my code:
8
10498
by: **Developer** | last post by:
ControlRichTextBox1.SelectedText = String.Format("{0} {1}", strExt, x.szTypeName) & vbCrLf Three questions: 1) How can I insert a tab between {0} and (1} so the richtextbox tabs x.szTypeName into a nice column?
6
1419
by: =?Utf-8?B?cm9nZXJfMjc=?= | last post by:
hey, I have a bunch of strings that are 20 characters long. The user inputs data 10 characters long and I am inserting data at character spot number 11. well what if the user inputs data that is 5 characters long? how do I insert spaces untill it is 10 characters long, so I can still use the string.insert at space number 11? I hope this made sense. thanks.
4
4378
by: alfred | last post by:
Hi everyone, I have a problem. I have create a string (its name is book) and i want to insert the books with this text formatting: First book Second book third book ecc.... with the end of line at the end of the string so if i want to write into a file XML this is the style that i want to do. In my program the XML is:
1
3066
by: kellysgirl | last post by:
Now what you are going to see posted here is both the set of instructions I was given..and the code I have written. The instructions I was given are as follows In this case, you will create a Visual Basic 2005 solution that manipulates strings. It will parse a string containing a list of items within a text box and put the individual items into the list box. It will build the textbox string by putting the list box items together into a...
3
3794
by: wildman | last post by:
Is there any way for gridview cells to observe vbcrlf in the data? I attempted to do this, but it does not seem to work. Dim dgItem As GridViewRow For Each dgItem In gridCollaborator.Rows dgItem.Cells(6).Text.Replace("-", vbCrLf + "-") Next I also tried <br>, no luck
8
4745
by: drjay1627 | last post by:
hello, This is my 1st post here! *welcome drjay* Thanks! I look answering questions and getting answers to other! Now that we got that out of the way. I'm trying to read in a string and add the unique words in the string to a map. Eg:
11
4380
by: blunt | last post by:
trying to write a program to write the configuration files for a load of wireless access points. i've never been a good programmer and haven't done any for nearly a decade so have obviously made some mistakes, i'm using cygwin on a windows pc and it seems that some functions cause stack overflows so am using fgets instead of fgetc (don't know y it solved the problem but that part is working). my problem now is that i am reading strings a few...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.