Re: Small question about strings.



Kaixo!

On Fri, Dec 28, 2001 at 08:55:15PM +0300, Syomin Pavel wrote:
> OK, I decide to use gchar arrays as a strngs. And what function I must
> use for getting string length?

You should not use the expression "string lenght" as it has no meaning
(all possible meanings are ambiguous).

Use instead, depending on what you actually want:
* "size in memory"
* "number of characters"
* "number of column positions"

even if for pure ascii those three mean the same, in most cases they mean
three different things.
And as such, you will need different functions to ask for each one of
the three.

> Can I use glibc's function strlen() or Gtk++ has other?

First you must know what exactly you want to measure.
strlen() only works for the first case: measuring the size in memory, but
*only* when dealing with byte-based encodings (8bit encodings, euc, utf-8 
and the such. Not for utf-16, ucs etc)


-- 
Ki a vos vye bn,
Pablo Saratxaga

http://www.srtxg.easynet.be/		PGP Key available, key ID: 0x8F0E4975




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]