rstr_len


Description:

public unowned string? rstr_len (ssize_t haystack_len, string needle)

Searches the string haystack for the last occurrence of the string needle, limiting the length of the search to haystack_len.

Example: Search for the last occurrence of a substring:

public static int main (string[] args) {
string str = "This is hardly rocket science, this is quantum physics!";
unowned string? pos = str.rstr_len (str.length, "science");
// Output: ``science, this is quantum physics!``
print ("%s\n", pos);
return 0;
}

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

Parameters:

haystack_len

the maximum length of haystack

needle

the nul-terminated string to search for

haystack

a nul-terminated string

Returns:

a pointer to the found occurrence, or null if not found.