Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7C61C200B9B for ; Wed, 12 Oct 2016 11:17:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7B56B160AD3; Wed, 12 Oct 2016 09:17:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C2061160AEE for ; Wed, 12 Oct 2016 11:17:22 +0200 (CEST) Received: (qmail 32723 invoked by uid 500); 12 Oct 2016 09:17:21 -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 32586 invoked by uid 99); 12 Oct 2016 09:17:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Oct 2016 09:17:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 832C82C4C73 for ; Wed, 12 Oct 2016 09:17:21 +0000 (UTC) Date: Wed, 12 Oct 2016 09:17:21 +0000 (UTC) From: "Bruno P. Kinoshita (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1231) StringUtils#indexOfAny() methods with start position argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 12 Oct 2016 09:17:23 -0000 [ https://issues.apache.org/jira/browse/LANG-1231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15568151#comment-15568151 ] Bruno P. Kinoshita commented on LANG-1231: ------------------------------------------ You are right that there is no such method [~gsavinov]. So if you have the following code. {code} String s = "paralalelepipedo"; int i = StringUtils.indexOfAny(s, "p"); System.out.println(i); {code} Would print 0, the first occurrence of 'p'. >Well, java.lang.String.substring(int beginIndex) can be used, so maybe it's Ok to pass substring as an argument. That's correct as well. {code} String s = "paralalelepipedo"; int i = StringUtils.indexOfAny(s.substring(1), "p"); System.out.println(i); {code} Would print 9, the then first occurrence of 'p' in the substring (i.e. aralalelepipedo). You may have to account for the substring later (i.e. in the original string, the index would be 10, not 9). But I think it would be better to use the substring for now. What do you think? If you have other use cases for this, feel free to add a comment or send a pull request or patch :-) Cheers > StringUtils#indexOfAny() methods with start position argument > ------------------------------------------------------------- > > Key: LANG-1231 > URL: https://issues.apache.org/jira/browse/LANG-1231 > Project: Commons Lang > Issue Type: New Feature > Components: lang.* > Affects Versions: 3.4 > Reporter: Guram Savinov > Priority: Minor > Labels: string > > There is no StringUtils#indexOfAny() methods with start position argument, which would search for specified characters from the specified position. > Please add it. -- This message was sent by Atlassian JIRA (v6.3.4#6332)