note 129192 added to class.numberformatter

From: Date: Tue, 23 Jan 2024 18:49:29 +0000
Subject: note 129192 added to class.numberformatter
Groups: php.notes 
Request: Send a blank email to php-notes+get-221146@lists.php.net to get a copy of this message
Be aware that (at least with the locale 'fr-FR') NumberFormatter doesn't use spaces. It doesn't even use non breakable spaces (NBSP). It uses narrow non breakable spaces (NNBSP). This broke my tests. <?php $formatter = new NumberFormatter( 'fr-FR', NumberFormatter::DEFAULT_STYLE ); $value = $formatter->format(100_000); // '100 000' // If you want to replace narrow non breakable spaces with non breakable spaces: str_replace("\u{202F}", "\u{00A0}", $value); // If you want to replace it with a normal space str_replace("\u{202F}", " ", $value); ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 37.166.32.56) ---- Manual Page -- https://php.net/manual/en/class.numberformatter.php Edit -- https://main.php.net/note/edit/129192 Del: integrated -- https://main.php.net/note/delete/129192/integrated Del: useless -- https://main.php.net/note/delete/129192/useless Del: bad code -- https://main.php.net/note/delete/129192/bad+code Del: spam -- https://main.php.net/note/delete/129192/spam Del: non-english -- https://main.php.net/note/delete/129192/non-english Del: in docs -- https://main.php.net/note/delete/129192/in+docs Del: other reasons-- https://main.php.net/note/delete/129192 Reject -- https://main.php.net/note/reject/129192 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221146) next »