rstr_len
Description:
[ CCode ( cname = "g_strrstr_len" ) ]
public unowned string? rstr_len (ssize_t haystack_len, string needle)
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 |
needle |
the string to search for |
haystack |
a string to search in |
Returns:
a pointer to the found occurrence, or `NULL` if not found |