Results 1 to 3 of 3

Thread: [RESOLVED] A long word within a string...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Ithaca, NY
    Posts
    145

    Resolved [RESOLVED] A long word within a string...

    I'm trying to release my website before next Monday and this one thing is bothering me but I don't have time to look into it. In one place, my users can enter a large string, up to 1024 characters in length. This is fine, however I want to limit the character length for a single word so that their entered text doesn't obstruct or change the site layout.

    So say I wanted to limit the length of a single word to 20 characters so I place a line break so that the word wraps around rather than stretching the page...

    EX:

    turn the word

    asdfasdfasdfasdfasdfasdfasdfasdfasdf

    INTO

    asdfasdfasdfasdfasdf<br>asdfasdfasdfasdf

    without affecting the rest of the 1024 characters..

    How would I go about doing this?

  2. #2
    Lively Member
    Join Date
    Jun 2005
    Posts
    116

    Re: A long word within a string...

    $newtext = wordwrap($text, 20, "<br />", true);
    http://us2.php.net/wordwrap

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Location
    Ithaca, NY
    Posts
    145

    Re: A long word within a string...

    sweet!

    thanks

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