Re: [Vala] How to obtain number of elements in array



On Sun, Apr 27, 2008 at 11:16 PM, Jaap A. Haitsma <jaap haitsma org> wrote:
Hi,

 How do I obtain that the following string array has two elements

        const string[] x = {
                "string1",
                "string2"
        };

 Ofcourse I can do something like

 num = 0;

 foreach (string y in x) {
   num++;
 }
 but I'm looking for something to obtain it at once

 So something like

 num = x.length();

OK found it. It's

num = x.length;

Jaap



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