Re: [Vala] byte array <-> string



Actually, now that I think of it, there is one more problem.

There is a convert () method, that converts from one charset to
another. The problem is that its input and output are both of string
type, which should always be UTF-8 in Vala.

So I think it would be better to have something like:

uchar[] string_to_array (string input, string output_charset = "utf-8");
string   array_to_string (uchar[] input, string input_charset = "utf-8");

which would solve both problems in one go.

Dne 15. červen 2009 17:22 Jiří Zárevúcky <zarevucky jiri gmail com> napsal(a):
Hello. It seems to me that there is no easy way to convert these two
to each other. I'd suggest adding one method and one constructor or
static method to the string class. "uint8[] to_byte_array ()" and
"String.from_byte_array (uint8[] array, size_t start = 0, size_t len =
-1)". Is it possible?




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