note 70047 added to function.preg-replace
| From: | norten at gmail dot com | Date: | Sun, 01 Oct 2006 15:16:06 +0000 |
| Subject: | note 70047 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117898@lists.php.net to get a copy of this message | ||
In Hungary we use the "," character to separate the integer and the fraction part of
numbers. This little script replaces all "," between two numbers to the English-style
".":
<?php
$text = "The result is 23,3 m.";
$text = preg_replace("/([0-9])([,])([0-9])/","$1.$3",$text);
print $text;
//output: The result is 23,3 m.
?>
----
Server IP: 195.70.37.52
Probable Submitter: 81.183.182.158
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/70047
Del: integrated -- https://master.php.net/note/delete/70047/integrated
Del: useless -- https://master.php.net/note/delete/70047/useless
Del: bad code -- https://master.php.net/note/delete/70047/bad+code
Del: spam -- https://master.php.net/note/delete/70047/spam
Del: non-english -- https://master.php.net/note/delete/70047/non-english
Del: in docs -- https://master.php.net/note/delete/70047/in+docs
Del: other reasons-- https://master.php.net/note/delete/70047
Reject -- https://master.php.net/note/reject/70047
Search -- https://master.php.net/manage/user-notes.php