|
-
Sep 30th, 2003, 03:41 PM
#1
Thread Starter
Stuck in the 80s
[Resolved] Extremely Long Words
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000
This is really annoying. How could I have my scripts detect a really long word and truncate it before it displays the text? I could loop every word and use strlen(), but...is there a better way?
Last edited by The Hobo; Sep 30th, 2003 at 04:36 PM.
-
Sep 30th, 2003, 03:43 PM
#2
Thread Starter
Stuck in the 80s
eh, it seems vBulletin takes care of it. But otherwise, that would be displayed as one really long word and cause massive horizontal scroll bars.
-
Sep 30th, 2003, 04:19 PM
#3
Member
vB seems to do it like this:
PHP Code:
preg_replace("#([^\n\r ?&./<>\"\\-\[\]]{80})#i", "\\\\1 ", $text)
Test it out, not sure if thats the right code though, not good at those regx.
-
Sep 30th, 2003, 04:27 PM
#4
Thread Starter
Stuck in the 80s
That doesn't seem to do anything.
-
Sep 30th, 2003, 04:28 PM
#5
Member
I screwed up on the copy+paste I think
But look here, I got it to work: http://chris.devbox.net/test.php
You can customize the 2nd parameter (\\1\n) to be whatever you want. I put in a newline, but you can put in an HTML break or anything. (vBulletin makes it a space so the browser will put it on a new line)
-
Sep 30th, 2003, 04:36 PM
#6
Thread Starter
Stuck in the 80s
Perfect! Thanks, bro.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|