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

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



-------- Forwarded Message --------
> From: Yu Feng <rainwoodman gmail com>
> To: Jürg Billeter <j bitron ch>
> Subject: Re: [Vala] How to obtain number of elements in array
> Date: Wed, 30 Apr 2008 01:37:35 -0400
> 
> Not always.
> 
> If the string is created by:
> string s = "a|b|c";
> string[] x = s.split("|");
> 
> we will always have x.length == -1.
> 
> Don't know how to deal with it then. expose a static method in string
> class? 
> There seems to be no explicit place to put the g_strv_length call
> cleanly in the code generator, because in the compiler string is a
> ordinary class and string[] is a ordinary array.
> 
> Yu


I am also wondering why evolution always reply the email to the sender
instead of the maillist.

Yu



> On Sun, 2008-04-27 at 23:26 +0200, Jürg Billeter wrote:
> > Hi,
> > 
> > On Sun, 2008-04-27 at 23:16 +0200, Jaap A. Haitsma wrote:
> > > How do I obtain that the following string array has two elements
> > > 
> > > 	const string[] x = {
> > > 		"string1",
> > > 		"string2"
> > > 	};	
> > > [...]
> > > So something like
> > > 
> > > num = x.length();
> > 
> > 	num = x.length;
> > 
> > should work fine.
> > 
> > Jürg
> > 
> > _______________________________________________
> > Vala-list mailing list
> > Vala-list gnome org
> > http://mail.gnome.org/mailman/listinfo/vala-list



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