wrapping a long string at 80 chars

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Scharlemann

    #1

    wrapping a long string at 80 chars

    Hey all

    I'm working on creating a "send an email to a friend" page that
    includes the link of a given search from a website. However, the url
    of the website is really long and when displayed on the page it screws
    up all of the formatting. Is there a way to force a wrap of the text?
    Say each line is approx 80 characters.

    I don't believe there is a simple HTML solution...want ed to see if
    anyone on this forum had to do this previously and has some code to
    share.

    Thanks, Greg

  • Ewoud Dronkert

    #2
    Re: wrapping a long string at 80 chars

    Greg Scharlemann wrote:[color=blue]
    > Is there a way to force a wrap of the text?[/color]

    Wraps a string to a given number of characters


    --
    E. Dronkert

    Comment

    • Greg Scharlemann

      #3
      Re: wrapping a long string at 80 chars


      Ewoud Dronkert wrote:[color=blue]
      > Greg Scharlemann wrote:[color=green]
      > > Is there a way to force a wrap of the text?[/color]
      >
      > http://php.net/wordwrap[/color]

      Sweet. Thanks.

      Comment

      • Greg Scharlemann

        #4
        Re: wrapping a long string at 80 chars

        > > > Is there a way to force a wrap of the text?[color=blue][color=green]
        > >
        > > http://php.net/wordwrap[/color]
        >[/color]

        The wordwrap function doesn't seem to work. It appears to wrap at the
        next space in the string, but if I have a URL, there are no spaces and
        thus no wrapping. Any other thoughts?

        Comment

        • Kim André Akerø

          #5
          Re: wrapping a long string at 80 chars

          Greg Scharlemann wrote:
          [color=blue][color=green][color=darkred]
          > > > > Is there a way to force a wrap of the text?
          > > >
          > > > http://php.net/wordwrap[/color]
          > >[/color]
          >
          > The wordwrap function doesn't seem to work. It appears to wrap at the
          > next space in the string, but if I have a URL, there are no spaces and
          > thus no wrapping. Any other thoughts?[/color]

          If you want to force a wrap on, say, an URL, just use the "cut"
          parameter. See example 2 in the manual entry for wordwrap().

          --
          Kim André Akerø
          - kimandre@NOSPAM betadome.com
          (remove NOSPAM to contact me directly)

          Comment

          • Ewoud Dronkert

            #6
            Re: wrapping a long string at 80 chars

            Greg Scharlemann wrote:[color=blue][color=green][color=darkred]
            >>> http://php.net/wordwrap[/color][/color]
            >
            > The wordwrap function doesn't seem to work. It appears to wrap at the
            > next space in the string, but if I have a URL, there are no spaces and
            > thus no wrapping. Any other thoughts?[/color]

            Yeah. Read it properly.

            --
            E. Dronkert

            Comment

            Working...