I want to display a string in a table but when a word in the string is
longer then 40 letters it won't wrap. Does anyone know how I can fix this ?
Thanx
Wannes 8 3122
where would you expect it to wrap? if it's a single, uninterrupted, string
of characters the browser has no idea where to break it, besides it's not
right to break it most likely. You'll have to build a custom string reader
to insert a "<br>" or linebreak (if displayed in a textbox, etc).
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"news.pandora.be" <no@no.com> wrote in message
news:ed**********************@phobos.telenet-ops.be... I want to display a string in a table but when a word in the string is longer then 40 letters it won't wrap. Does anyone know how I can fix this
? Thanx
Wannes
And how would I have te do that ?
"Curt_C [MVP]" <software_AT_darkfalz.com> schreef in bericht
news:eG**************@TK2MSFTNGP09.phx.gbl... where would you expect it to wrap? if it's a single, uninterrupted, string of characters the browser has no idea where to break it, besides it's not right to break it most likely. You'll have to build a custom string reader to insert a "<br>" or linebreak (if displayed in a textbox, etc).
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"news.pandora.be" <no@no.com> wrote in message news:ed**********************@phobos.telenet-ops.be... I want to display a string in a table but when a word in the string is longer then 40 letters it won't wrap. Does anyone know how I can fix
this ? Thanx
Wannes
What kind of word is longer than 40 letters? Where would it make sense to
break up such a word? Exactly in half, after 20 characters, after 32
characters, 5 characters from the end, ...?
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
"news.pandora.be" <no@no.com> wrote in message
news:ed**********************@phobos.telenet-ops.be... I want to display a string in a table but when a word in the string is longer then 40 letters it won't wrap. Does anyone know how I can fix this ?
Thanx
Wannes
It's in a sort of message board so I cant realy controle what will be
displayed in the table.
I have to make shure that if someone has put in such long words my table
will still be displayed as it should.
Therefor I'm looking for an ASP-code that places an "<BR>" into my string if
there are words longer than 40 letters in it. It doesn't realy matter to me
where the words are broken as long as they are.
gr.
Wannes
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> schreef in bericht
news:O6**************@tk2msftngp13.phx.gbl... What kind of word is longer than 40 letters? Where would it make sense to break up such a word? Exactly in half, after 20 characters, after 32 characters, 5 characters from the end, ...?
-- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/
"news.pandora.be" <no@no.com> wrote in message news:ed**********************@phobos.telenet-ops.be...I want to display a string in a table but when a word in the string is longer then 40 letters it won't wrap. Does anyone know how I can fix
this ?
Thanx
Wannes
I would do something like this when you STORE the data (then you don't have
to do it every time you display it).
data = request.form("data")
datas = split(data, " ")
for i = 0 to ubound(datas)
if len(datas(i))>40 then
tmp = ""
for i = 1 to len(datas(i)) step 40
tmp = tmp & "<br>" & mid(str, i, 40)
next
datas(i) = tmp
end if
next
data = join(datas, " ")
' now replace single apostrophes with two, insert into db, etc.
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
"news.pandora.be" <no@no.com> wrote in message
news:SJ**********************@phobos.telenet-ops.be... It's in a sort of message board so I cant realy controle what will be displayed in the table. I have to make shure that if someone has put in such long words my table will still be displayed as it should. Therefor I'm looking for an ASP-code that places an "<BR>" into my string if there are words longer than 40 letters in it. It doesn't realy matter to me where the words are broken as long as they are.
gr.
Wannes
"Aaron Bertrand [MVP]" <aa***@TRASHaspfaq.com> schreef in bericht news:O6**************@tk2msftngp13.phx.gbl... What kind of word is longer than 40 letters? Where would it make sense to break up such a word? Exactly in half, after 20 characters, after 32 characters, 5 characters from the end, ...?
-- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/
"news.pandora.be" <no@no.com> wrote in message news:ed**********************@phobos.telenet-ops.be... >I want to display a string in a table but when a word in the string is > longer then 40 letters it won't wrap. Does anyone know how I can fix this > ? > > Thanx > > Wannes > >
> tmp = tmp & "<br>" & mid(str, i, 40)
OOPS! Change str to datas(i) here.
On Mon, 17 May 2004 18:20:47 GMT, "news.pandora.be" <no@no.com> wrote: And how would I have te do that ?
Something Like:
NewString = ""
StringLength = Len(WordString)
For i = 1 to (StringLength/40)
NewString = NewString & Left(WordString,40) & "<br>" & VbCrLf
StringLength = StringLength - 40
WordString = Right(WordString,StringLength)
Next
Response.Write NewString
Note, this isn't tested and it only breaks the string into 40
character lines, doesn't break on words or spaces.
But there's probably a WordWrap function floating around that
someone's already written. Hang on...
Yep. Google finds your answer: http://www.planet-source-code.com/vb...txtCodeId=6220
Jeff "Curt_C [MVP]" <software_AT_darkfalz.com> schreef in bericht news:eG**************@TK2MSFTNGP09.phx.gbl... where would you expect it to wrap? if it's a single, uninterrupted, string of characters the browser has no idea where to break it, besides it's not right to break it most likely. You'll have to build a custom string reader to insert a "<br>" or linebreak (if displayed in a textbox, etc).
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"news.pandora.be" <no@no.com> wrote in message news:ed**********************@phobos.telenet-ops.be... > I want to display a string in a table but when a word in the string is > longer then 40 letters it won't wrap. Does anyone know how I can fix this ? > > Thanx > > Wannes > >
news.pandora.be wrote on 17 mei 2004 in
microsoft.public.inetserver.asp.general: It's in a sort of message board so I cant realy controle what will be displayed in the table. I have to make shure that if someone has put in such long words my table will still be displayed as it should. Therefor I'm looking for an ASP-code that places an "<BR>" into my string if there are words longer than 40 letters in it. It doesn't realy matter to me where the words are broken as long as they are.
this simple j(ava)script script breaks all words
longer than 40 chars long into 40 char parts
ended by a - and a space:
t = t.replace(/(\S{40})/g,"$1- ")
======================
same in vbscript [longer]:
Set regEx = New RegExp
regEx.Pattern = "(\S{40})"
regEx.Global = True
t = regEx.Replace(t, "$1- ")
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: yawnmoth |
last post by:
word wrapping normally treats some spaces as line feeds, if there
hasn't been a line feed for quite a while. so while a string with
eighty consecutive a's might not word wrap, a space placed...
|
by: Douglas G |
last post by:
I've tried various ideas on this problem, but I don't see word wrapping.
Can you point out what is wrong? It's a K&R exercise, and I'm still new to
programming. Other pointers would be helpful...
|
by: Jeff B. |
last post by:
Has anyone come across a decent algorithm for implementing word wrap
features in .net printing? I have a small component that uses basic
printing techniques (i.e. e.Graphics.DrawString in a...
|
by: Lorenzo Thurman |
last post by:
I have a table cell that I want to wrap text inside of. I've tried both
hard and soft wrap, but Firefox refuses to obey. IE 6&7 handle the wrap
just fine. Does anyone know how I can fix this?
|
by: funeeldy |
last post by:
I need to locate a particular table in a document. I cannot hardcode the table number since it could be different in every doc.
I do have some header text that comes right before it consistently,...
|
by: gazza67 |
last post by:
Hi,
I want to do something that I thought would be simple but i cant seem
to work it out, perhaps someone out there could help me.
I want to browse for a file (it will be a word document),...
|
by: etuncer |
last post by:
Hello All,
I have Access 2003, and am trying to build a database for my small
company. I want to be able to create a word document based on the data
entered through a form. the real question is...
|
by: winston.heng |
last post by:
Hi,
Thanks for reading this posting. I have been cracking my head on
solving the infinite loop
when i call the following section code. Any help or advise is greatly
appreciated =D
Thanks in...
|
by: Eric Layman |
last post by:
Hi,
I have fields from textareas.
With a click of a button, php is able to grab these fields and by using
header(), convert the output to Ms Word doc.
But the outcome of the word doc...
|
by: vedika |
last post by:
Hello,
I have problem with word-wrapping. When width is given in pixel style="word-wrap:word-break" works well but when it is given in percentage then it is not working.
<table border="1"...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
| |