2022-02-06 10:08:32 -05:00
|
|
|
#pragma once
|
|
|
|
//
|
|
|
|
// FILE: Soundex.h
|
|
|
|
// AUTHOR: Rob Tillaart
|
2023-02-02 13:16:24 -05:00
|
|
|
// VERSION: 0.1.4
|
2022-02-06 10:08:32 -05:00
|
|
|
// DATE: 2022-02-05
|
|
|
|
// PURPOSE: Arduino Library for calculating Soundex hash
|
|
|
|
// URL: https://github.com/RobTillaart/Soundex
|
|
|
|
|
|
|
|
|
|
|
|
#include "Arduino.h"
|
|
|
|
|
|
|
|
|
2023-02-02 13:16:24 -05:00
|
|
|
#define SOUNDEX_LIB_VERSION (F("0.1.4"))
|
2022-02-07 08:46:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
#define SOUNDEX_MIN_LENGTH 4
|
2022-02-06 10:08:32 -05:00
|
|
|
|
2023-02-02 13:16:24 -05:00
|
|
|
#ifndef SOUNDEX_MAX_LENGTH
|
|
|
|
#define SOUNDEX_MAX_LENGTH 12
|
|
|
|
#endif
|
2022-02-07 08:46:24 -05:00
|
|
|
|
|
|
|
|
2022-02-06 10:08:32 -05:00
|
|
|
class Soundex
|
|
|
|
{
|
|
|
|
public:
|
2023-02-02 13:16:24 -05:00
|
|
|
Soundex();
|
2022-02-06 10:08:32 -05:00
|
|
|
|
2022-02-07 08:46:24 -05:00
|
|
|
void setLength(uint8_t length = 4);
|
2023-02-02 13:16:24 -05:00
|
|
|
uint8_t getLength();
|
2022-02-06 10:08:32 -05:00
|
|
|
|
2022-11-24 14:21:52 -05:00
|
|
|
char * soundex(const char * str); // Russel and Odell
|
|
|
|
uint16_t soundex16(const char * str); // Russel and Odell length = 5
|
|
|
|
uint32_t soundex32(const char * str); // Russel and Odell length = 10
|
2022-02-06 10:08:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
2022-02-07 08:46:24 -05:00
|
|
|
char _buffer[SOUNDEX_MAX_LENGTH];
|
|
|
|
uint8_t _length;
|
2022-02-06 10:08:32 -05:00
|
|
|
|
2022-11-24 14:21:52 -05:00
|
|
|
uint8_t sdx[26] = {0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2};
|
2022-02-06 10:08:32 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-02-02 13:16:24 -05:00
|
|
|
// -- END OF FILE --
|
2022-02-06 10:08:32 -05:00
|
|
|
|