std/text/string▲toc

Extended string operations and a string builder.

A builderstd/text/string/builder: H -> V is used to append strings in linear time.

O(n). Read the current string from a string builder.

O(1). Prepend a string in front of a string builder.

Indent all lines a string s by n. fill is used for indentation, by default " ".

Return the Jaro distance between two strings. This is a number between 1.0 and 0.0 where 1.0 is a perfect match. Works best for small words and names.
jaro-distancestd/text/string/jaro-distance: (s : string, t : string) -> double("martha","marhta") == 0.94
jaro-distancestd/text/string/jaro-distance: (s : string, t : string) -> double("abrams","abroms") == 0.89.

Return the Jaro-Winkler distance between two strings. This is a number between 1.0 and 0.0 where 1.0 is a perfect match. . Works best for small words and names. Jaro-Winkler is a variation of a plain jaro-distancestd/text/string/jaro-distance: (s : string, t : string) -> double developed by the U.S. census for name comparison and it gives a higher score to strings that have a common prefix.
Scores are only boosted if the jaro-distancestd/text/string/jaro-distance: (s : string, t : string) -> double is above the boost-threshold (= 0.7) The maximal common prefix length considered is given by prefix-len (= 4) * The scale modifies the boosted amount (= 0.1). It is adjusted dynamically depending on the prefix-len to ensure no result can be higher then 1.0.
jaro-distancestd/text/string/jaro-distance: (s : string, t : string) -> double("martha","marhta") == 0.96
jaro-distancestd/text/string/jaro-distance: (s : string, t : string) -> double("abrams","abroms") == 0.92.

Do action with a given builderstd/text/string/builder: H -> V and return the stringstd/core/string: V that was built.