has_prefix
Description:
[ Version ( since = "2.2" ) ]
[ CCode ( cname = "g_str_has_prefix" ) ]
public bool has_prefix (string prefix)
[ CCode ( cname = "g_str_has_prefix" ) ]
public bool has_prefix (string prefix)
Looks whether the string str
begins with prefix
.
Example: Check whether the string begins with a prefix:
public static int main (string[] args) {
// Output: ``true``
bool res = "Would You Like a Jelly Baby".has_prefix ("Would");
print ("%s\n", res.to_string ());
// Output: ``false``
res = "Would You Like a Jelly Baby".has_prefix ("Dalek");
print ("%s\n", res.to_string ());
return 0;
}
valac --pkg glib-2.0 string.has_prefix.vala
Parameters:
prefix |
the prefix to look for |
str |
a string to look in |
Returns:
true if |