Re: [Vala] [Soup] How to convert uint8[] to string?



Oh, thanks :)

2010/2/10 Jiří Zárevúcky <zarevucky jiri gmail com>:
Бака Гайдзин píše v St 10. 02. 2010 v 18:03 +0200:
Hi!

In the new version of Vala (0.7.10) Soup.Message.response_body.data
returns uint8[] instead string, like in older versions. Is there any
standart way to convert this value to string?
I wrote this piece of code, but it is very ugly and slow, I think:

var session = new SessionAsync();
var message = new Message("GET", "http://meta.ua";);
session.send_message(message);

string result = "";
for(int i = 0; i < message.response_body.length; i++) {
      result += ((char)message.response_body.data[i]).to_string();
}

Hope for your suggestion.


This is actually very very simple:

var result = (string) message.response_body.data;





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