[phobos] UTF-8 string slicing

Michel Fortin michel.fortin at michelf.com
Fri Aug 19 10:47:31 PDT 2011


Which of course wouldn't really work if you had invisible characters like the soft-hyphen or the zero-width space, or if you had combining marks in a decomposed form.

Le 2011-08-19 à 10:36, Sean Kelly a écrit :

> The few times I used it were for trimming a buffer to some length for display purposes. 
> 
> Sent from my iPhone
> 
> On Aug 19, 2011, at 5:41 AM, Walter Bright <walter at digitalmars.com> wrote:
> 
>> Sean Kelly wrote:
>>> 
>>> I need to do this from time to time, but I generally just do something like:
>>> 
>>> buf[0 .. buf.toUCSindex(n)]
>>> 
>>> A shorthand might be nice though, I suppose.
>>> 
>>> 
>> 
>> Somewhat surprisingly, such a function is rarely needed (I've never needed it in working with UTF8)
>> and so I don't think a special syntax for it is justified.
>> _______________________________________________
>> phobos mailing list
>> phobos at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the phobos mailing list