Skip to content

Add StringUtils.startsWithIgnoreCase#580

Closed
JeromeWolff wants to merge 2 commits intoapache:masterfrom
JeromeWolff:add-starts-with-equals-ignore-case
Closed

Add StringUtils.startsWithIgnoreCase#580
JeromeWolff wants to merge 2 commits intoapache:masterfrom
JeromeWolff:add-starts-with-equals-ignore-case

Conversation

@JeromeWolff
Copy link

As the name of the method says: This method is the same as String.startsWith except that it is case insensitive.

@garydgregory
Copy link
Member

I am not a fan of adding more and more "ignore case" versions of APIs.

For 4.0, we could consider a new StringUtils class that has two default instances, one that is case-sensitive, the other not, which you would use like:

StringUtils.DEFAULT.theApiYouWant(...); // case-sensitive
StringUtils.NAME_CASE_SENSITIVE.theApiYouWant(...);
StringUtils.NAME_CASE_INSENSITIVE.theApiYouWant(...);

The alternative for now might be to override the existing API with a boolean or maybe an enum that says what kind of case-sensitivity you want.

Any thoughts from the community?

@JeromeWolff JeromeWolff changed the title Add StringUtils.startsWithEqualsIgnoreCase Add StringUtils.startsWithIgnoreCase Jul 7, 2020
@JeromeWolff
Copy link
Author

Yes, that's a very good suggestion. I wonder why I wrote equalsIgnoreCase several times instead of ignoreCase.

@JeromeWolff
Copy link
Author

I have overlooked the fact that such a method already exists. Therefore I close this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants