Re: removing characters from beginning of string
| From: | Steve Edberg | Date: | Wed, 12 Jul 2000 02:06:23 +0000 |
| Subject: | Re: removing characters from beginning of string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6049@lists.php.net to get a copy of this message | ||
At 12:49 PM -0700 7/11/00, Bill Zeller wrote:
Hi, You could try: $new_string = ereg_replace("^,", "", $string);Or, to remove the first comma (regardless of whether it is the first character or not): $new_string = ereg_replace('([^,]*),(.*)', '\\1\\2', $string); Untested; I've been in 'administrator mode' or 'vacation mode' for the past weeks rather than 'programmer mode', so my off-the-top-of-the-head regexps might need some polishing (for example, the second field might need to be '\1\2' instead of '\\1\\2'). -steve
Best Regards, Bill Zeller http://www.scriptmakers.com (in beta) --- Jason Bryner <jason@focusdesigngroup.com> wrote: I have the following string and I need to remove the first comma and leave the rest of the string intact. ,"1" => array("date"=>"7/11/2000", "author"=>"Jason Bryner" Any ideas?+--- unix and cats: -----------------------------------------------------+
| Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu |+----------------------- hard to befriend, but then friends for life! ---+