The Wayback Machine - https://web.archive.org/web/20201103183422/https://github.com/TheAlgorithms/Java/pull/1864
Skip to content
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

Adding a CheckSubstrings.java file to new_branch #1864

Open
wants to merge 1 commit into
base: master
from

Conversation

@AruneshNaha
Copy link

@AruneshNaha AruneshNaha commented Oct 18, 2020

Describe your change:

  • Check substring in a string
@SethiPandi
Copy link

@SethiPandi SethiPandi commented Oct 18, 2020

I don't think this is a particularly useful addition to the repository.

And I don't think this is even considered an "algorithm" really, it's just two standard Java methods, toLowerCase and contains.

The method names are misleading, a better name would be containsIgnoreCase. (Like what equalsIgnoreCase is to equals.)
There is also no need to initialize the boolean if you'll assign it a new value right after.

The entire method could've been written as:

return a.toLowerCase().contains(b.toLowerCase());

Also it doesn't include a link to an algorithm or anything either. Ie a Wikipedia Article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.