String replacement
| From: | Peter Bowen | Date: | Sun, 06 Aug 2000 00:16:07 +0000 |
| Subject: | String replacement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10285@lists.php.net to get a copy of this message | ||
I have a string with markers in it. I want to replace the section of
text with a formated section of text.
For example:
Original string = "This is a string. <CAP>This part should be
capitalized.</CAP>"
I want to use the "<CAP>" and "</CAP>" substrings as markers. I
then
want to take the
text in the middle, pass it to a function, and replace the entire
substring, including markers.
Using the above example, I would pass "This part should be capitalized."
to a function, in this
case strtoupper, and replace it. The result would be:
New string = "This is a string. THIS PART SHOULD BE CAPITALIZED."
I figured out how to find the markers, but could you suggestions beyond
that.
Thanks.
Peter