Forcing a break in a long string

Results 1 to 2 of 2

Thread: Forcing a break in a long string

  1. #1
    Join Date
    Dec 1969

    Default Forcing a break in a long string

    Example: A user signs a messageboard, and puts a URL in their post. But the url is some 100 characters long...and the table it has been printed in stretches out to accomodate the length of the URL. Now the entire structure of the website is screwed up, because the table that should be 400px is now stretched to 600px.<BR><BR>How can I force the line to stop once it reaches 400px?

  2. #2
    Join Date
    Dec 1969

    Default Easy, but...

    ...the hard part is trying to match up the break with a given number of pixels.<BR><BR>Unless you are using a fixed width font and you *know* the number of pixels in each character, trying to guess how many characters equals how many pixels is essentially impossible, using HTML characteristics. (For example, the user can override any font size you set by using VIEW &#124 Text Size in MSIE.)<BR><BR>If you are willing to live with a guess, then just doing<BR>&nbsp; &nbsp; Response.Write Left( theURLstring, 50 )<BR>[or however many characters you decide on] will chop the string at the count of characters you specify.<BR><BR>

Posting Permissions

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