Function

IdeCompletionfuzzy_match

Declaration

gboolean
ide_completion_fuzzy_match (
  const gchar* haystack,
  const gchar* 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.

Available since:3.32

Parameters

haystack const gchar*
 

The string to be searched.

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

A g_utf8_casefold() version of the needle.

 The data is owned by the caller of the function.
 The value 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.

Return value

Returns: gboolean
 

TRUE if haystack matched casefold_needle, otherwise FALSE.