[Vala] How can I sort an array of strings?
- From: "K. König" <kkoenig posteo de>
- To: vala-list gnome org
- Subject: [Vala] How can I sort an array of strings?
- Date: Thu, 21 Apr 2011 14:22:12 +0200
Hi,
I need to sort an array of strings in natural order but the solutions I
found didn't worked for me. I tried this:
/* Method to fill the array files */
protected void get_files() {
string file = "";
do {
file = dir.read_name();
this.files += file;
} while(file != null);
/* Cut "null" which was only needed to terminate the loop */
this.files.resize(files.length-1);
this.files.sort(strcmp);
}
'dir' is an opened directory and files is an array of strings (private
static string[] files). I get this message: 'error: The name `sort' does
not exist in the context of `string[]' this.files.sort(strcmp);'
Does anyone know what goes wrong?
Regards,
Karsten
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]