Skip to content

feat: add IsPalindrome snippet with unit test and README entry #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tarun2684
Copy link

@tarun2684 tarun2684 commented Jul 22, 2025

Description

This PR adds a new Kotlin snippet IsPalindrome.kt to the codecollection.snippets.strings package.
The function checks whether a given string is a palindrome, ignoring punctuation and spacing.

Changes:

  • Added: src/main/kotlin/codecollection/snippets/strings/IsPalindrome.kt
  • Added: src/test/kotlin/codecollection/snippets/strings/IsPalindromeTest.kt
  • Updated: README.md with an entry for the new snippet
  • Minor: Fixed import order in the test file to pass KtLint check

Related Issue

Closes #18


Let me know if any further changes are needed!

@github-actions github-actions bot added the type: snippet Small, reusable Kotlin functions or expressions label Jul 22, 2025
@e5LA
Copy link
Owner

e5LA commented Jul 25, 2025

Thanks for taking the time to contribute👏

class IsPalindromeTest {

@Test
fun testPalindromeWithSimpleWord() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the rest of the codebase, please rename test functions using backticks and natural language descriptions (e.g., fun recognizes simple word palindrome()). Here and in functions below.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the feedback! 🙌
I’ll update the test function names to use backticks and natural language descriptions as suggested (e.g., fun recognizes simple word palindrome()), to keep it consistent with the rest of the codebase. Appreciate you pointing that out — will make the changes shortly!

Copy link
Owner

@e5LA e5LA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @tarun2684, looks really good!

Just one point - I think by mistake you have also commited entire /bin/ folder. Now, your Pull Request shows 25 changed files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: snippet Small, reusable Kotlin functions or expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check if a string is a palindrome
2 participants