Results 1 to 6 of 6

Thread: [Resolved] Extremely Long Words

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    [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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    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.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    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.

  4. #4

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    That doesn't seem to do anything.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    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)

  6. #6

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Perfect! Thanks, bro.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width