GY-63_MS5611/libraries/palindrome/readme.md

90 lines
3.1 KiB
Markdown
Raw Normal View History

2021-12-03 09:28:47 -05:00
[![Arduino CI](https://github.com/RobTillaart/palindrome/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/palindrome/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/palindrome/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/palindrome/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/palindrome/actions/workflows/jsoncheck.yml)
2023-11-14 11:12:20 -05:00
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/palindrome.svg)](https://github.com/RobTillaart/palindrome/issues)
2021-12-03 09:28:47 -05:00
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/palindrome/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/palindrome.svg?maxAge=3600)](https://github.com/RobTillaart/palindrome/releases)
2023-11-14 11:12:20 -05:00
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/palindrome.svg)](https://registry.platformio.org/libraries/robtillaart/palindrome)
2021-12-03 09:28:47 -05:00
# Palindrome
Library for palindrome search
## Description
The palindrome library can test if a string is a palindrome and is able to find
the longest palindrome within a character string.
2023-11-14 11:12:20 -05:00
This library is written mainly for some educational purpose, however other
applications are possible. Please share your ideas.
#### tests
2021-12-03 09:28:47 -05:00
The library is tested with an Arduino UNO, random string of 1600 characters.
2023-11-14 11:12:20 -05:00
(TODO performance compare)
2021-12-03 09:28:47 -05:00
## Interface
2023-11-14 11:12:20 -05:00
```cpp
#include "palindrome.h"
```
2021-12-03 09:28:47 -05:00
- **palindrome()** constructor.
- **int findPalindrome(const char \* str, int & position, int & length)** find the longest palindrome in a string. (first occurrence).
- **int findEvenPalindrome(const char \* str, int & position, int & length)** find the longest palindrome in a string with even length. (first occurrence).
- **int findOddPalindrome(const char \* str, int & position, int & length)** find the longest palindrome in a string with odd length. (first occurrence).
- **bool isPalindrome(const char \* str)** checks if a string is a palindrome.
2023-11-14 11:12:20 -05:00
- **int palindromeCount(const char \* str)** returns the count of matching pairs in a string.
This is at most the ```length / 2 + 1```.
2021-12-03 09:28:47 -05:00
- **float palindromePercentage(const char \* str)** returns the count as percentage 0.0 .. 100.0 %
## Operation
The examples show the basic working of the functions.
## Questions
- is an empty string a palindrome?
## Future
2023-11-14 11:12:20 -05:00
#### Must
2021-12-03 09:28:47 -05:00
- update documentation
2023-11-14 11:12:20 -05:00
#### Should
#### Could
2021-12-03 09:28:47 -05:00
- function names?
- palindromeCount -- symmetryCount?
- palindromePercentage -- symmetryPercentage?
- improve algorithms
- merge odd / even find algorithms?
- investigate Print interface?
- investigate palindrome for numbers - radix 2..16 (36?)
- investigate case (in)sensitive flag?
- investigate ignore spaces flag?
2023-11-14 11:12:20 -05:00
#### Wont
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,