Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2C6307BC0 for ; Thu, 25 Aug 2011 15:30:47 +0000 (UTC) Received: (qmail 30536 invoked by uid 500); 25 Aug 2011 15:30:46 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 30459 invoked by uid 500); 25 Aug 2011 15:30:46 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 30445 invoked by uid 99); 25 Aug 2011 15:30:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Aug 2011 15:30:45 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of flamefew@gmail.com designates 209.85.216.171 as permitted sender) Received: from [209.85.216.171] (HELO mail-qy0-f171.google.com) (209.85.216.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Aug 2011 15:30:38 +0000 Received: by qyk36 with SMTP id 36so4008076qyk.9 for ; Thu, 25 Aug 2011 08:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=oO0ba6TFS85M95+7A8/OJ5EcQcSvVBOrZDqxr6o6VJk=; b=UIbuhLT5RfkCW/tqJcKdofqq/v5L0mJZc+Mdxh01kz27v/Fg3kua3LbX0a/2akqtGg SrKl+RrJEMult/GSM004Hxb63+yxLGPnytur1qMTZQ0LAn6AMEzCJa26NOKqRzjI5LVI 2WcJvqyjpAgt1vxqJLD4Q8RhF7abG51kswSHM= MIME-Version: 1.0 Received: by 10.229.72.162 with SMTP id m34mr695907qcj.189.1314286217517; Thu, 25 Aug 2011 08:30:17 -0700 (PDT) Received: by 10.229.248.144 with HTTP; Thu, 25 Aug 2011 08:30:17 -0700 (PDT) In-Reply-To: <1314165743.30525.5.camel@hukku> References: <1314165743.30525.5.camel@hukku> Date: Thu, 25 Aug 2011 08:30:17 -0700 Message-ID: Subject: Re: [lang]Question about StringUtils chomp and removeEnd From: Henri Yandell To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Agreed :) Nice catch. I'll also deprecate the chomp(String,String) version for removal in 4.0. Hen On Tue, Aug 23, 2011 at 11:02 PM, Verneri =C5berg = wrote: > Hi all, > > I was just browsing through StringUtils Api (versions 2.5, 2.6 and > 3.0.1) and found two very similar looking methods > > chomp(String,String) > and > removeEnd(String, String) > > So I started to wonder what is the difference here and looked at the > source code. > > To my astonishment the only difference is that chomp returns the source > string immediately if the removed string is null and remove end > additionally checks for empty strings too. > > So wouldn't it be better to substitute the duplication by simply > replacing the chomp method with following version? > > public String chomp(String source, String separator) { > =A0 =A0 =A0 =A0return removeEnd(source,separator); > } > > Or is there some hidden idea for two different implementations of the > same string chompping function? if there is maybe it should be added to > both methods javadocs? > > =A0Verneri > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org