Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 36088 invoked from network); 5 Mar 2010 18:55:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Mar 2010 18:55:05 -0000 Received: (qmail 50077 invoked by uid 500); 5 Mar 2010 18:54:50 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 50014 invoked by uid 500); 5 Mar 2010 18:54:50 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 50006 invoked by uid 99); 5 Mar 2010 18:54:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 18:54:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Mar 2010 18:54:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 61081234C4CF for ; Fri, 5 Mar 2010 18:54:27 +0000 (UTC) Message-ID: <1868066578.103411267815267396.JavaMail.jira@brutus.apache.org> Date: Fri, 5 Mar 2010 18:54:27 +0000 (UTC) From: "Shaun Elliott (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr) In-Reply-To: <1519440865.103361267815027362.JavaMail.jira@brutus.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LANG-600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841972#action_12841972 ] Shaun Elliott commented on LANG-600: ------------------------------------ I can confirm this. Running the following: // Copied from the javadoc System.out.println( StringUtils.lastIndexOf( null, "*" ) ); System.out.println( StringUtils.lastIndexOf( "*", null ) ); System.out.println( StringUtils.lastIndexOf( "", "" ) ); System.out.println( StringUtils.lastIndexOf( "aabaabaa", "a" ) ); System.out.println( StringUtils.lastIndexOf( "aabaabaa", "b" ) ); System.out.println( StringUtils.lastIndexOf( "aabaabaa", "ab" ) ); System.out.println( StringUtils.lastIndexOf( "aabaabaa", "" ) ); Yields this: -1 -1 0 7 5 4 8 Not this (as presented in the javadoc): -1 -1 0 0 2 1 8 > Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr) > ------------------------------------------------------------------------------------ > > Key: LANG-600 > URL: https://issues.apache.org/jira/browse/LANG-600 > Project: Commons Lang > Issue Type: Task > Components: lang.* > Affects Versions: 2.4 > Reporter: Sean Montgomery > Priority: Trivial > > The javadoc's examples show how indexOf should work not lastIndexOf. > StringUtils.lastIndexOf(null, *) = -1 > StringUtils.lastIndexOf(*, null) = -1 > StringUtils.lastIndexOf("", "") = 0 > StringUtils.lastIndexOf("aabaabaa", "a") = 0 > StringUtils.lastIndexOf("aabaabaa", "b") = 2 > StringUtils.lastIndexOf("aabaabaa", "ab") = 1 > StringUtils.lastIndexOf("aabaabaa", "") = 8 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.