Skip to content
FutureBlitz

    Install

    Import std.text.fuzzy

    std.text.fuzzy

    std.text.fuzzy: fuzzy matching, as fzf does it. A pattern matches text that has its characters in order, with anything between them, and the best way to place them scores most: characters that follow each other, and ones at the start of a word, after a space, a /, or a _, or a capital in camelCase, score more, and gaps between them less. A pattern without capitals ignores case. Positions are byte positions, as a String's are.

    std/text/fuzzy.fb

    Types

    FuzzyMatch struct

    Public Struct FuzzyMatch

    What a fuzzy match found: its Score, higher for a better match, and the byte Positions of the text's characters that the pattern's matched, in order.

    std/text/fuzzy.fb, line 32

    • Public ReadOnly Field Score: Int field #

      How well the pattern matched: higher for a better match.

    • Public ReadOnly Field Positions: Int[] field #

      The byte positions of the characters the pattern's matched, in order.

    Fuzzy class

    Public Class Fuzzy

    Fuzzy matching's operations.

    std/text/fuzzy.fb, line 40

    • Public Static Method Match(pattern: String, text: String): FuzzyMatch? static method #

      The best match of pattern in text, or Null when text doesn't have pattern's characters in order. An empty pattern matches anything, scoring 0.

    • Public Static Method Score(pattern: String, text: String): Int? static method #

      pattern's score in text, or Null when it doesn't match.

    • Public Static Method Rank(pattern: String, candidates: String[]): String[] static method #

      The candidates that match pattern, the best first: by score, then the shorter, then in the order given.

    Report an issue with this page or with FutureBlitz on GitHub.