replace n first occurences of a char in a string

From: Date: Sat, 24 Jul 2004 02:09:15 +0000
Subject: replace n first occurences of a char in a string
Groups: php.general 
Request: Send a blank email to php-general+get-191719@lists.php.net to get a copy of this message
Hello all, If I have a string like this 123.456.789.01 , where dots are used to separate the thousands and the decimal part. How can I first detect this situation? More than one dot. I guess I could use str_word_count() from the manual, right? Then, once I have determined there are more than one dot, how can I remove all the dots but the right most one? so 123.456.789.01 would become 123456789.01 with just the dot before the zero. Thanks in advance.

« previous php.general (#191719) next »