Function

GtkSourceCompletionfuzzy_match

Declaration

gboolean
gtk_source_completion_fuzzy_match (
  const char* haystack,
  const char* casefold_needle,
  guint* priority
)

Description

This helper function can do a fuzzy match for you giving a haystack and casefolded needle.

Casefold your needle using g_utf8_casefold() before running the query.

Score will be set with the score of the match upon success. Otherwise, it will be set to zero.

Parameters

haystack const char*
 

The string to be searched.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
casefold_needle const char*
 

A g_utf8_casefold() version of the needle.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
priority guint*
 

An optional location for the score of the match.

 The argument will be set by the function.
 The argument can be NULL.
 The called function takes ownership of the data, and is responsible for freeing it.

Return value

Returns: gboolean
 

TRUE if haystack matched casefold_needle, otherwise FALSE.