Re: substrings
| From: | Evan Nemerson | Date: | Sun, 25 Apr 2004 21:41:01 +0000 |
| Subject: | Re: substrings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184588@lists.php.net to get a copy of this message | ||
On Sunday 25 April 2004 01:00 pm, David T-G wrote:
> Hi, all --
>
> I must be having a brain fart as well as going blind because I can't find
> in the manual how to do this.
>
> Given a string like #AABBCC or #112233 how do I get the
>
> 2nd-3rd
> 4th-5th
> 6th-7th
>
> position substrings so I can break out the red, green, and blue values?
php.net/substr?
> All of the regular expressions seem to hinge on matching a separator, and
> the closest thing seems to be a
>
> preg_match(".(..)(..)(..)",$color,$colors) ;
> $r = $colors[1] ;
> $g = $colors[2] ;
> $b = $colors[3] ;
>
> but it just seems like I should be able to return a list like
>
> ($r,$g,$b) = fn(operands,$color) ;
>
> or so.
>
>
> TIA & HAND
>
> :-D
--
Evan Nemerson
evan@coeus-group.com
http://coeusgroup.com/en