GY-63_MS5611/libraries/palindrome
2022-08-03 21:56:07 +02:00
..
.github add funding.yml 2022-08-03 21:56:07 +02:00
examples 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
test 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
.arduino-ci.yml 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
keywords.txt 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
library.json 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
library.properties 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
LICENSE 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
palindrome.cpp 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
palindrome.h 0.1.1 palindrome 2021-12-03 15:28:47 +01:00
readme.md 0.1.1 palindrome 2021-12-03 15:28:47 +01:00

Arduino CI Arduino-lint JSON check License: MIT GitHub release

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.

The library is tested with an Arduino UNO, random string of 1600 characters.

Interface

  • 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.
  • int palindromeCount(const char * str) returns the count of matching pairs in a string. This is at most the length / 2 + 1.
  • 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

  • update documentation
  • should this be a class?
  • 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?