[Vala] An elegant way to concatenate integers into a string.



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]