Re: [Vala] Starting with Vala, problems with strings

2009-04-20 Thread Diego Jacobi
Hi again. I am still having troubles with things that i should easily do in C. Maybe because i have never programmed in C#, or mono or anything like it. In my test code i want to split a math sentence in terms, like the next string example: (2+a)*d+(a*b-3)-4-q/2 My function split_in_terms, is a

[Vala] Starting with Vala, problems with strings

2009-04-19 Thread Diego Jacobi
Hi. This may be a too much newbie question, but: How do you access a character in a string? private static int my_string_handler(string *str) { string s; for (x = 0 ; x str-len() ; x++) { if (str[x]=='+') { s = str-substring(0,x);

Re: [Vala] Starting with Vala, problems with strings

2009-04-19 Thread Yu Feng
Hi Diego, private static int my_string_handler(string str)/*no '*'*/ { } If possible use unichar, string.next_char, string.get_char, to manipulate string is better than directly access the char by its location because all strings are utf8 encoded. StringBuilder sb = new StringBuilder();

Re: [Vala] Starting with Vala, problems with strings

2009-04-19 Thread Bart Goossens
Hi Diego, Also have a look at: http://live.gnome.org/Vala/FAQ#head-66eaa46cac67dfc44f5bc00929c746124e5f311d and http://mail.gnome.org/archives/vala-list/2008-April/msg00058.html Best regards, Bart Hi Diego, private static int my_string_handler(string str)/*no '*'*/ { } If