match_string
Description:
Matches a string against a compiled pattern.
If the string is to be matched against more than one pattern, consider using g_pattern_match
instead while supplying the reversed
string.
Example: Match a string against a compiled pattern:
public static int main (string[] args) {
PatternSpec spec = new PatternSpec ("dilbert-????/??/??.*");
// Output: ``true``
bool res = spec.match_string ("dilbert-1999/39/01.png");
print ("%s\n", res.to_string ());
// Output: ``true``
res = spec.match_string ("dilbert-1999/39/01.jpg");
print ("%s\n", res.to_string ());
// Output: ``false``
res = spec.match_string ("dilbert-1999X/39/01.jpg");
print ("%s\n", res.to_string ());
return 0;
}
valac --pkg glib-2.0 GLib.PatternSpec.match_string.vala
Parameters:
this | |
string |
the UTF-8 encoded string to match |
Returns:
true if |