Improve toString() using StringBuffer
from Chris Feldhacker git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137556 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fd27d2ecdf
commit
5fd988cfcb
|
@ -61,8 +61,9 @@ package org.apache.commons.lang;
|
||||||
*
|
*
|
||||||
* @author <a href="bayard@generationjava.com">Henri Yandell</a>
|
* @author <a href="bayard@generationjava.com">Henri Yandell</a>
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
|
* @author Chris Feldhacker
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Id: CharRange.java,v 1.8 2003/07/26 15:33:34 scolebourne Exp $
|
* @version $Id: CharRange.java,v 1.9 2003/08/02 11:20:49 scolebourne Exp $
|
||||||
*/
|
*/
|
||||||
class CharRange {
|
class CharRange {
|
||||||
|
|
||||||
|
@ -192,19 +193,19 @@ class CharRange {
|
||||||
/**
|
/**
|
||||||
* <p>Output a string representation of the character range.</p>
|
* <p>Output a string representation of the character range.</p>
|
||||||
*
|
*
|
||||||
* @return string representation
|
* @return string representation of this range
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String str = "";
|
StringBuffer buf = new StringBuffer(4);
|
||||||
if (isNegated()) {
|
if (isNegated()) {
|
||||||
str += "^";
|
buf.append('^');
|
||||||
}
|
}
|
||||||
str += start;
|
buf.append(start);
|
||||||
if (isRange()) {
|
if (isRange()) {
|
||||||
str += "-";
|
buf.append('-');
|
||||||
str += close;
|
buf.append(close);
|
||||||
}
|
}
|
||||||
return str;
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue