[Vala] Starting with Vala, problems with strings



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



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