contains


Description:

public bool contains (string needle)

Checks if a needle exists in string

Example: Check if a needle exists in string:

public static int main (string[] args) {
// Output: ``true``
bool res = "1234567890".contains ("678");
print ("%s\n", res.to_string ());

// Output: ``false``
res = "1234567890".contains ("ABC");
print ("%s\n", res.to_string ());

return 0;
}

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

Parameters:

needle

the string to search for

Returns:

returns true if needle is found in the string, false otherwise.