1 #ifndef CPP_UTILITIES_LEVENSHTEIN_H
2 #define CPP_UTILITIES_LEVENSHTEIN_H
3
4 #include "../global.h"
5
6 #include <cstring>
7 #include <string>
8
9 namespace CppUtilities {
10
11 CPP_UTILITIES_EXPORT std::size_t computeDamerauLevenshteinDistance(const char *str1, std::size_t size1, const char *str2, std::size_t size2);
12
computeDamerauLevenshteinDistance(const std::string & str1,const std::string & str2)13 inline std::size_t computeDamerauLevenshteinDistance(const std::string &str1, const std::string &str2)
14 {
15 return computeDamerauLevenshteinDistance(str1.data(), str1.size(), str2.data(), str2.size());
16 }
17
computeDamerauLevenshteinDistance(const char * str1,const char * str2)18 inline std::size_t computeDamerauLevenshteinDistance(const char *str1, const char *str2)
19 {
20 return computeDamerauLevenshteinDistance(str1, std::strlen(str1), str2, std::strlen(str2));
21 }
22
23 } // namespace CppUtilities
24
25 #endif // CPP_UTILITIES_LEVENSHTEIN_H
26