commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] [patch] CharRange utilizing StringBuffer
Date Sat, 02 Aug 2003 11:22:51 GMT
Code applied, thanks.
Next time, please attach the patch, do not embed in the email.
I had to manually apply the patch as emails mess up the format.
Stephen

----- Original Message -----
From: "Chris Feldhacker" <feldhacker.chris@mchsi.com>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Saturday, August 02, 2003 6:54 AM
Subject: [lang] [patch] CharRange utilizing StringBuffer


> [my first real post:]
> CharRange.toString() method was modified to utilize a StringBuffer.
>
>
> Index: CharRange.java
> ===================================================================
> RCS file:
>
/home/cvspublic/jakarta-commons/lang/src/java/org/apache/commons/lang/CharRa
> nge.java,v
> retrieving revision 1.8
> diff -u -r1.8 CharRange.java
> --- CharRange.java 26 Jul 2003 15:33:34 -0000 1.8
> +++ CharRange.java 2 Aug 2003 05:43:11 -0000
> @@ -195,16 +195,16 @@
>       * @return string representation
>       */
>      public String toString() {
> -        String str = "";
> +        StringBuffer buff = new StringBuffer(4);
>          if( isNegated() ) {
> -            str += "^";
> +            buff.append('^');
>          }
> -        str += start;
> +        buff.append(start);
>          if( isRange() ) {
> -            str += "-";
> -            str += close;
> +            buff.append('-');
> +            buff.append(close);
>          }
> -        return str;
> +        return buff.toString();
>      }
>
>  }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Mime
View raw message