last_index_of
Description:
Find the rightmost occurrence of the given string.
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
Parameters:
needle |
a string to look for |
start_index |
the starting position for the search in bytes. |
Returns:
the byte index of the last occurrence of |