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(""); for(weak string s = str; s.get_char()!=0; s = s.next_char()) { unichar c = s.get_char(); if(c != '+') sb.append_unichar(c); else { .... break; } } Yu On Sun, 2009-04-19 at 20:39 +0200, Diego Jacobi wrote: > 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); > stdout.printf("plus finded at = %d, left string ist %s\n", x, > s); > return 0; > } > } > return -1; > } > > This prints an error saying that str is not an array. > I cant find anything on the docs an example on how to manipulate > strings char by char. > > Cheers. > Diego > _______________________________________________ > Vala-list mailing list > Vala-list@gnome.org > http://mail.gnome.org/mailman/listinfo/vala-list _______________________________________________ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list