[swift-evolution] InternalString class for easy String manipulation

Charles Srstka cocoadev at charlessoft.com
Mon Aug 22 21:53:24 CDT 2016


> On Aug 19, 2016, at 1:05 AM, Félix Cloutier via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Even UTF-32 does not provide a 1-to-1 mapping to visual glyphs. As mentioned earlier in this thread, for instance, flags are composed of two Unicode characters.
> 
> Félix

I wonder how possible it would be to make a string type that stored a table containing references to runs of text encoded using single code units, either as ranges, indexes of multi-code-units characters, or some kind of search tree or something so that you could quickly randomly access a character without having to parse the whole string up to that point. It would consume additional memory, but since most of the world’s most commonly used writing systems all fall into the Basic Multilingual Plane, characters represented by a single UTF-16 word should be the overwhelming majority in most cases, which might make it not completely unworkable.

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160822/94ea1961/attachment.html>


More information about the swift-evolution mailing list