"Jason Giangrande" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Five wrote:
> > "Five" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> >
> >>I just finished looking through string functions
> >>http://us2.php.net/manual/en/ref.strings.php
> >>and can't find one that inserts a character, not replaces one.
> >>
> >>If there's a string that's over 50 chars long without a space, I want to insert a 
> >>space without replacing or losing any of the
> >>original characters. Is there a function to do that?
> >>
> >>advance thanks,
> >>Dale
> >
> >
> > I should add that, unless there's a function that does it all, I'm not really 
> > concerned with the finding the 50th char part. I
know
> > there's other funcs for that kind of thing. It's just that all I'm trying to do is 
> > make sure that when the string is output, it
will
> > wrap to the width of a table and not stretch the table width to suit it's fancy.
> > If I manufacture a function to do all of the little things necessary to make this 
> > thing wrap, it seems like a lot of ugly code
to do
> > a simple task.
> >
>
> Use substr_replace() and set the length value to 0.  Here's an example:
>
> $text = "Thistext";
> echo "$text<br />";
> $text = substr_replace($text, " ", 4, 0);
> echo $text;
>
> Test it and you will see that a space is added into the text without
> replacing any of it.
>
> -- 
> Jason Giangrande <[EMAIL PROTECTED]>
> http://www.giangrande.org
> http://www.dogsiview.com


Thanks Jason

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to