note 127706 added to class.intlcodepointbreakiterator

From: Date: Sun, 09 Oct 2022 01:38:22 +0000
Subject: note 127706 added to class.intlcodepointbreakiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-219655@lists.php.net to get a copy of this message
An example of using this to find all the code points in a string that cannot be transliterated to Latin-ASCII: <?php $string = "Народm, Intl gurus get paid €10000/hr 😁"; $latinAscii = Transliterator::create('NFC; Any-Latin; Latin-ASCII;'); $transliterated = $latinAscii->transliterate($string); $codePoints = IntlBreakIterator::createCodePointInstance(); $codePoints->setText($transliterated); foreach ($codePoints->getPartsIterator() as $char) { $ord = IntlChar::ord($char); if (255 < $ord) { echo IntlChar::charName($ord) . "\n"; } } ?> Outputs: EURO SIGN GRINNING FACE WITH SMILING EYES ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.161 (proxied: 2a00:23c4:718d:901:d946:7962:89ff:2090) ---- Manual Page -- https://php.net/manual/en/class.intlcodepointbreakiterator.php Edit -- https://main.php.net/note/edit/127706 Del: integrated -- https://main.php.net/note/delete/127706/integrated Del: useless -- https://main.php.net/note/delete/127706/useless Del: bad code -- https://main.php.net/note/delete/127706/bad+code Del: spam -- https://main.php.net/note/delete/127706/spam Del: non-english -- https://main.php.net/note/delete/127706/non-english Del: in docs -- https://main.php.net/note/delete/127706/in+docs Del: other reasons-- https://main.php.net/note/delete/127706 Reject -- https://main.php.net/note/reject/127706 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219655) next »