Example: Find the rightmost occurrence of a string

public static int main (string[] args) {
string str = "/this/is/my/file.en.txt";
int i = str.last_index_of (".");

// Output: ``txt``
print ("%s\n", str.substring (i + 1));
return 0;
}

 valac --pkg glib-2.0 string.last_index_of.vala

See:




2022 vala-language.org