Re: [RFC] IntlChar class and intl_char_*() functions
| From: | Stanislav Malyshev | Date: | Fri, 28 Nov 2014 06:49:39 +0000 |
| Subject: | Re: [RFC] IntlChar class and intl_char_*() functions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79261@lists.php.net to get a copy of this message | ||
Hi!
> You mean something along the lines of JavaScript’s
> String.fromCharCode (or, in ES6, String.fromCodePoint)?
Yes, exactly.
> One of the nice things about that function is that it can take
> multiple codes. So I can do String.fromCodePoint(65, 66, 67) to get
> “ABC”.
Well, that is nice but if we have it for one we can always use
array_map() :) We could make it accept as many code points as we want,
of course.
> If we add that, we should also have an analogue of JavaScript’s
> String.charCodeAt/String.codePointAt to do the operation in reverse.
That'd be a bit harder since it's not clear what "at" means there -
byte? codepoint? grapheme? what about broken UTF-8 sequences? What if
you run this function on non-UTF-8 array? Etc. So this one is trickier,
the other direction is easy.
--
Stas Malyshev
smalyshev@gmail.com