all groups > inetserver asp components > may 2004 >
You're in the

inetserver asp components

group:

word wrap


Re: word wrap Curt_C [MVP]
5/17/2004 1:17:40 PM
inetserver asp components: 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


[quoted text, click to view]

Re: word wrap Aaron Bertrand [MVP]
5/17/2004 2:32:37 PM
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/





[quoted text, click to view]

Re: word wrap Aaron Bertrand [MVP]
5/17/2004 2:59:20 PM
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/





[quoted text, click to view]

Re: word wrap Aaron Bertrand [MVP]
5/17/2004 3:04:33 PM
[quoted text, click to view]

OOPS! Change str to datas(i) here.

word wrap news.pandora.be
5/17/2004 6:09:14 PM
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

Re: word wrap news.pandora.be
5/17/2004 6:20:47 PM
And how would I have te do that ?

"Curt_C [MVP]" <software_AT_darkfalz.com> schreef in bericht
news:eGMCDrDPEHA.3476@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: word wrap news.pandora.be
5/17/2004 6:44:02 PM
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]" <aaron@TRASHaspfaq.com> schreef in bericht
news:O6j8V1DPEHA.1048@tk2msftngp13.phx.gbl...
[quoted text, click to view]

Re: word wrap Evertjan.
5/17/2004 7:29:24 PM
news.pandora.be wrote on 17 mei 2004 in
microsoft.public.inetserver.asp.general:

[quoted text, click to view]

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.
AddThis Social Bookmark Button