Skip to content

add lastIndexOfAnyChar method just like indexOfAny#273

Open
qxo wants to merge 2 commits intoapache:masterfrom
qxo:master
Open

add lastIndexOfAnyChar method just like indexOfAny#273
qxo wants to merge 2 commits intoapache:masterfrom
qxo:master

Conversation

@qxo
Copy link
Copy Markdown

@qxo qxo commented Jun 29, 2017

No description provided.

@PascalSchumacher
Copy link
Copy Markdown
Contributor

Thanks for the pull request, but the build fails because of checkstyle violations, see: https://travis-ci.org/apache/commons-lang/jobs/248359934 for details.

@aaabramov
Copy link
Copy Markdown
Contributor

@PascalSchumacher will it be okay if I will fix warnings for the author?

@PascalSchumacher
Copy link
Copy Markdown
Contributor

PascalSchumacher commented Jul 4, 2017

@Abrasha You can create a pull request for @qxo fork. If it is merged, it will be added to this pull request.

@PascalSchumacher
Copy link
Copy Markdown
Contributor

@Abrasha Thank you very much for the offer, but I think you should give @qxo some more time (a few days) to fix it himself.

@qxo
Copy link
Copy Markdown
Author

qxo commented Jul 5, 2017

ok, I'll check it :)

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 5, 2017

Coverage Status

Coverage decreased (-0.008%) to 95.164% when pulling 68e41b1 on qxo:master into 5f0d812 on apache:master.

Copy link
Copy Markdown
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Please review my comments.

* @param searchChars the chars to search for, may be null
* @return the last index of any of the chars, -1 if no match or null input
*/
public static int lastIndexOfAnyChar( final CharSequence cs,final char... searchChars) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix formatting.

}

/**
* <p>Search a CharSequence to find the last index of any
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use the active voice in Javadoc: "Returns...", "Searches...", "Gets..." and so on.


@Test
public void testLastIndexOfAny_StringCharArray() {
assertEquals(-1, StringUtils.lastIndexOfAnyChar(null, (char[]) null));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe use INDEX_NOT_FOUND as a static import instead of -1...

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.

5 participants