Browse Source

Remove string::fuzzyScore().

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
b8fd869ae4
2 changed files with 0 additions and 15 deletions
  1. +0
    -6
      include/string.hpp
  2. +0
    -9
      src/string.cpp

+ 0
- 6
include/string.hpp View File

@@ -31,12 +31,6 @@ bool startsWith(const std::string& str, const std::string& prefix);
/** Returns whether a string ends with the given substring. */
bool endsWith(const std::string& str, const std::string& suffix);

/** Scores how well a query matches a string.
A score of 0 means no match.
The score is arbitrary and is only meaningful for sorting.
*/
float fuzzyScore(const std::string& s, const std::string& query);

/** Converts a byte array to a Base64-encoded string.
https://en.wikipedia.org/wiki/Base64
*/


+ 0
- 9
src/string.cpp View File

@@ -100,15 +100,6 @@ bool endsWith(const std::string& str, const std::string& suffix) {
}


float fuzzyScore(const std::string& s, const std::string& query) {
size_t pos = s.find(query);
if (pos == std::string::npos)
return 0.f;

return (float)(query.size() + 1) / (s.size() + 1);
}


std::string toBase64(const uint8_t* data, size_t dataLen) {
static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";



Loading…
Cancel
Save