note 104602 added to function.preg-split
| From: | eric at clarinova dot com | Date: | Fri, 24 Jun 2011 22:04:12 +0000 |
| Subject: | note 104602 added to function.preg-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180938@lists.php.net to get a copy of this message | ||
Here is another way to split a CamelCase string, which is a simpler expression than the one using
lookaheads and lookbehinds:
preg_split('/([[:upper:]][[:lower:]]+)/', $last, null,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY)
It makes the entire CamelCased word the delimiter, then returns the delimiters
(PREG_SPLIT_DELIM_CAPTURE) and omits the empty values between the delimiters (PREG_SPLIT_NO_EMPTY)
----
Server IP: 69.147.83.197
Probable Submitter: 74.62.51.2
----
Manual Page -- http://www.php.net/manual/en/function.preg-split.php
Edit -- https://master.php.net/note/edit/104602
Del: integrated -- https://master.php.net/note/delete/104602/integrated
Del: useless -- https://master.php.net/note/delete/104602/useless
Del: bad code -- https://master.php.net/note/delete/104602/bad+code
Del: spam -- https://master.php.net/note/delete/104602/spam
Del: non-english -- https://master.php.net/note/delete/104602/non-english
Del: in docs -- https://master.php.net/note/delete/104602/in+docs
Del: other reasons-- https://master.php.net/note/delete/104602
Reject -- https://master.php.net/note/reject/104602
Search -- https://master.php.net/manage/user-notes.php