Re: utf
>> > What is the length of a string?
>> When is that relevant?
> When you're trying to display one on a screen, or print one on paper.
To display a string you don't just need its length, you need the actual
bitmap representation, and getting info such as length is trivial once
you've rendered the string into a bitmap (finding relevant fonts, etc..).
Also, when it comes to display you never really care about the length of
the string: you typically care about its pixel-width and
pixel-height instead.
> When you've been asked to find the longest/shortest string from a list.
> When you've been asked to sort a list of strings by length.
Again, if it's for display purposes, you'll want to use the actually
pixel-width instead, which again introduces the need to figure out which
font (or set of fonts since many/most fonts only cover a subset of
Unicode) to use, etc...
> Or in other words, basically every time you do anything with the string
> at all other than blindly byte-copying it to a different place in memory.
Your experience is quite different from mine.
Stefan
Reply to:
- References:
- utf
- From: mess-mate <mess-mate@gmx.com>
- Re: utf
- From: Ben Caradoc-Davies <ben@transient.nz>
- Re: utf
- From: Andre Majorel <aym-naibed@teaser.fr>
- Re: utf
- From: Darac Marjal <mailinglist@darac.org.uk>
- Re: utf
- From: Ben Caradoc-Davies <ben@transient.nz>
- Re: utf
- From: Nicolas George <george@nsup.org>
- Re: utf
- From: Greg Wooledge <wooledg@eeg.ccf.org>