[Vala] An elegant way to concatenate integers into a string.
- From: Celil <celil kj gmail com>
- To: vala-list gnome org
- Subject: [Vala] An elegant way to concatenate integers into a string.
- Date: Mon, 14 Jun 2010 17:47:12 -0700
I would like to translate the following python code snippet to vala:
x = [1,2,3]
print ",".join(map(str, x))
So far I have this:
int[] x = {1,2,3};
string[] y = {};
foreach (var e in x) { y += e.to_string(); }
stdout.printf(string.joinv(",", y));
Is there a better way to do this? Dose vala support something equivalent
to the python built-in `map` function?
Celil
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]