Java Doc for StrBuilder.java in  » Library » Apache-common-lang » org » apache » commons » lang » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache common lang » org.apache.commons.lang.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.lang.text.StrBuilder

StrBuilder
public class StrBuilder implements Cloneable(Code)
Builds a string from constituent parts providing a more flexible and powerful API than StringBuffer.

The main differences from StringBuffer/StringBuilder are:

  • Not synchronized
  • Not final
  • Subclasses have direct access to character array
  • Additional methods
    • appendWithSeparators - adds an array of values, with a separator
    • appendPadding - adds a length padding characters
    • appendFixedLength - adds a fixed width field to the builder
    • toCharArray/getChars - simpler ways to get a range of the character array
    • delete - delete char or string
    • replace - search and replace for a char or string
    • leftString/rightString/midString - substring without exceptions
    • contains - whether the builder contains a char or string
    • size/clear/isEmpty - collections style API methods
  • Views
    • asTokenizer - uses the internal buffer as the source of a StrTokenizer
    • asReader - uses the internal buffer as the source of a Reader
    • asWriter - allows a Writer to write directly to the internal buffer
  • The aim has been to provide an API that mimics very closely what StringBuffer provides, but with additional methods. It should be noted that some edge cases, with invalid indices or null input, have been altered - see individual methods. The biggest of these changes is that by default, null will not output the text 'null'. This can be controlled by a property, StrBuilder.setNullText(String) .
    author:
       Stephen Colebourne
    since:
       2.2
    version:
       $Id: StrBuilder.java 492371 2007-01-04 00:42:05Z scolebourne $


    Inner Class :class StrBuilderTokenizer extends StrTokenizer
    Inner Class :class StrBuilderReader extends Reader
    Inner Class :class StrBuilderWriter extends Writer

    Field Summary
    final static  intCAPACITY
         The extra capacity for new builders.
    protected  char[]buffer
         Internal data storage.
    protected  intsize
         Current size of the buffer.

    Constructor Summary
    public  StrBuilder()
         Constructor that creates an empty builder initial capacity 32 characters.
    public  StrBuilder(int initialCapacity)
         Constructor that creates an empty builder the specified initial capacity.
    public  StrBuilder(String str)
         Constructor that creates a builder from the string, allocating 32 extra characters for growth.

    Method Summary
    public  StrBuilderappend(Object obj)
         Appends an object to this string builder.
    public  StrBuilderappend(String str)
         Appends a string to this string builder.
    public  StrBuilderappend(String str, int startIndex, int length)
         Appends part of a string to this string builder.
    public  StrBuilderappend(StringBuffer str)
         Appends a string buffer to this string builder.
    public  StrBuilderappend(StringBuffer str, int startIndex, int length)
         Appends part of a string buffer to this string builder.
    public  StrBuilderappend(StrBuilder str)
         Appends another string builder to this string builder.
    public  StrBuilderappend(StrBuilder str, int startIndex, int length)
         Appends part of a string builder to this string builder.
    public  StrBuilderappend(char[] chars)
         Appends a char array to the string builder.
    public  StrBuilderappend(char[] chars, int startIndex, int length)
         Appends a char array to the string builder.
    public  StrBuilderappend(boolean value)
         Appends a boolean value to the string builder.
    public  StrBuilderappend(char ch)
         Appends a char value to the string builder.
    public  StrBuilderappend(int value)
         Appends an int value to the string builder using String.valueOf.
    public  StrBuilderappend(long value)
         Appends a long value to the string builder using String.valueOf.
    public  StrBuilderappend(float value)
         Appends a float value to the string builder using String.valueOf.
    public  StrBuilderappend(double value)
         Appends a double value to the string builder using String.valueOf.
    public  StrBuilderappendAll(Object[] array)
         Appends each item in an array to the builder without any separators.
    public  StrBuilderappendAll(Collection coll)
         Appends each item in a collection to the builder without any separators.
    public  StrBuilderappendAll(Iterator it)
         Appends each item in an iterator to the builder without any separators.
    public  StrBuilderappendFixedWidthPadLeft(Object obj, int width, char padChar)
         Appends an object to the builder padding on the left to a fixed width.
    public  StrBuilderappendFixedWidthPadLeft(int value, int width, char padChar)
         Appends an object to the builder padding on the left to a fixed width.
    public  StrBuilderappendFixedWidthPadRight(Object obj, int width, char padChar)
         Appends an object to the builder padding on the right to a fixed length.
    public  StrBuilderappendFixedWidthPadRight(int value, int width, char padChar)
         Appends an object to the builder padding on the right to a fixed length.
    public  StrBuilderappendNewLine()
         Appends the new line string to this string builder.
    public  StrBuilderappendNull()
         Appends the text representing null to this string builder.
    public  StrBuilderappendPadding(int length, char padChar)
         Appends the pad character to the builder the specified number of times.
    public  StrBuilderappendSeparator(String separator)
         Appends a separator if the builder is currently non-empty.
    public  StrBuilderappendSeparator(char separator)
         Appends a separator if the builder is currently non-empty.
    public  StrBuilderappendSeparator(String separator, int loopIndex)
         Appends a separator to the builder if the loop index is greater than zero.
    public  StrBuilderappendSeparator(char separator, int loopIndex)
         Appends a separator to the builder if the loop index is greater than zero.
    public  StrBuilderappendWithSeparators(Object[] array, String separator)
         Appends an array placing separators between each value, but not before the first or after the last.
    public  StrBuilderappendWithSeparators(Collection coll, String separator)
         Appends a collection placing separators between each value, but not before the first or after the last.
    public  StrBuilderappendWithSeparators(Iterator it, String separator)
         Appends an iterator placing separators between each value, but not before the first or after the last.
    public  StrBuilderappendln(Object obj)
         Appends an object followed by a new line to this string builder.
    public  StrBuilderappendln(String str)
         Appends a string followed by a new line to this string builder.
    public  StrBuilderappendln(String str, int startIndex, int length)
         Appends part of a string followed by a new line to this string builder.
    public  StrBuilderappendln(StringBuffer str)
         Appends a string buffer followed by a new line to this string builder.
    public  StrBuilderappendln(StringBuffer str, int startIndex, int length)
         Appends part of a string buffer followed by a new line to this string builder.
    public  StrBuilderappendln(StrBuilder str)
         Appends another string builder followed by a new line to this string builder.
    public  StrBuilderappendln(StrBuilder str, int startIndex, int length)
         Appends part of a string builder followed by a new line to this string builder.
    public  StrBuilderappendln(char[] chars)
         Appends a char array followed by a new line to the string builder.
    public  StrBuilderappendln(char[] chars, int startIndex, int length)
         Appends a char array followed by a new line to the string builder.
    public  StrBuilderappendln(boolean value)
         Appends a boolean value followed by a new line to the string builder.
    public  StrBuilderappendln(char ch)
         Appends a char value followed by a new line to the string builder.
    public  StrBuilderappendln(int value)
         Appends an int value followed by a new line to the string builder using String.valueOf.
    public  StrBuilderappendln(long value)
         Appends a long value followed by a new line to the string builder using String.valueOf.
    public  StrBuilderappendln(float value)
         Appends a float value followed by a new line to the string builder using String.valueOf.
    public  StrBuilderappendln(double value)
         Appends a double value followed by a new line to the string builder using String.valueOf.
    public  ReaderasReader()
         Gets the contents of this builder as a Reader.
    public  StrTokenizerasTokenizer()
         Creates a tokenizer that can tokenize the contents of this builder.

    This method allows the contents of this builder to be tokenized. The tokenizer will be setup by default to tokenize on space, tab, newline and formfeed (as per StringTokenizer).

    public  WriterasWriter()
         Gets this builder as a Writer that can be written to.

    This method allows you to populate the contents of the builder using any standard method that takes a Writer.

    To use, simply create a StrBuilder, call asWriter, and populate away.

    public  intcapacity()
         Gets the current size of the internal character array buffer.
    public  charcharAt(int index)
         Gets the character at the specified index.
    public  StrBuilderclear()
         Clears the string builder (convenience Collections API style method).
    public  booleancontains(char ch)
         Checks if the string builder contains the specified char.
    public  booleancontains(String str)
         Checks if the string builder contains the specified string.
    public  booleancontains(StrMatcher matcher)
         Checks if the string builder contains a string matched using the specified matcher.
    public  StrBuilderdelete(int startIndex, int endIndex)
         Deletes the characters between the two specified indices.
    public  StrBuilderdeleteAll(char ch)
         Deletes the character wherever it occurs in the builder.
    public  StrBuilderdeleteAll(String str)
         Deletes the string wherever it occurs in the builder.
    public  StrBuilderdeleteAll(StrMatcher matcher)
         Deletes all parts of the builder that the matcher matches.
    public  StrBuilderdeleteCharAt(int index)
         Deletes the character at the specified index.
    public  StrBuilderdeleteFirst(char ch)
         Deletes the character wherever it occurs in the builder.
    public  StrBuilderdeleteFirst(String str)
         Deletes the string wherever it occurs in the builder.
    public  StrBuilderdeleteFirst(StrMatcher matcher)
         Deletes the first match within the builder using the specified matcher.
    public  booleanendsWith(String str)
         Checks whether this builder ends with the specified string.
    public  StrBuilderensureCapacity(int capacity)
         Checks the capacity and ensures that it is at least the size specified.
    public  booleanequals(StrBuilder other)
         Checks the contents of this builder against another to see if they contain the same character content.
    public  booleanequals(Object obj)
         Checks the contents of this builder against another to see if they contain the same character content.
    public  booleanequalsIgnoreCase(StrBuilder other)
         Checks the contents of this builder against another to see if they contain the same character content ignoring case.
    public  char[]getChars(char[] destination)
         Copies the character array into the specified array.
    public  voidgetChars(int startIndex, int endIndex, char destination, int destinationIndex)
         Copies the character array into the specified array.
    public  StringgetNewLineText()
         Gets the text to be appended when a new line is added.
    public  StringgetNullText()
         Gets the text to be appended when null is added.
    public  inthashCode()
         Gets a suitable hash code for this builder.
    public  intindexOf(char ch)
         Searches the string builder to find the first reference to the specified char.
    public  intindexOf(char ch, int startIndex)
         Searches the string builder to find the first reference to the specified char.
    public  intindexOf(String str)
         Searches the string builder to find the first reference to the specified string.
    public  intindexOf(String str, int startIndex)
         Searches the string builder to find the first reference to the specified string starting searching from the given index.
    public  intindexOf(StrMatcher matcher)
         Searches the string builder using the matcher to find the first match.
    public  intindexOf(StrMatcher matcher, int startIndex)
         Searches the string builder using the matcher to find the first match searching from the given index.
    public  StrBuilderinsert(int index, Object obj)
         Inserts the string representation of an object into this builder.
    public  StrBuilderinsert(int index, String str)
         Inserts the string into this builder.
    public  StrBuilderinsert(int index, char chars)
         Inserts the character array into this builder.
    public  StrBuilderinsert(int index, char chars, int offset, int length)
         Inserts part of the character array into this builder.
    public  StrBuilderinsert(int index, boolean value)
         Inserts the value into this builder.
    public  StrBuilderinsert(int index, char value)
         Inserts the value into this builder.
    public  StrBuilderinsert(int index, int value)
         Inserts the value into this builder.
    public  StrBuilderinsert(int index, long value)
         Inserts the value into this builder.
    public  StrBuilderinsert(int index, float value)
         Inserts the value into this builder.
    public  StrBuilderinsert(int index, double value)
         Inserts the value into this builder.
    public  booleanisEmpty()
         Checks is the string builder is empty (convenience Collections API style method).
    public  intlastIndexOf(char ch)
         Searches the string builder to find the last reference to the specified char.
    public  intlastIndexOf(char ch, int startIndex)
         Searches the string builder to find the last reference to the specified char.
    public  intlastIndexOf(String str)
         Searches the string builder to find the last reference to the specified string.
    public  intlastIndexOf(String str, int startIndex)
         Searches the string builder to find the last reference to the specified string starting searching from the given index.
    public  intlastIndexOf(StrMatcher matcher)
         Searches the string builder using the matcher to find the last match.
    public  intlastIndexOf(StrMatcher matcher, int startIndex)
         Searches the string builder using the matcher to find the last match searching from the given index.
    public  StringleftString(int length)
         Extracts the leftmost characters from the string builder without throwing an exception.

    This method extracts the left length characters from the builder.

    public  intlength()
         Gets the length of the string builder.
    public  StringmidString(int index, int length)
         Extracts some characters from the middle of the string builder without throwing an exception.
    public  StrBuilderminimizeCapacity()
         Minimizes the capacity to the actual length of the string.
    public  StrBuilderreplace(int startIndex, int endIndex, String replaceStr)
         Replaces a portion of the string builder with another string.
    public  StrBuilderreplace(StrMatcher matcher, String replaceStr, int startIndex, int endIndex, int replaceCount)
         Advanced search and replaces within the builder using a matcher.
    public  StrBuilderreplaceAll(char search, char replace)
         Replaces the search character with the replace character throughout the builder.
    public  StrBuilderreplaceAll(String searchStr, String replaceStr)
         Replaces the search string with the replace string throughout the builder.
    public  StrBuilderreplaceAll(StrMatcher matcher, String replaceStr)
         Replaces all matches within the builder with the replace string.
    public  StrBuilderreplaceFirst(char search, char replace)
         Replaces the first instance of the search character with the replace character in the builder.
    public  StrBuilderreplaceFirst(String searchStr, String replaceStr)
         Replaces the first instance of the search string with the replace string.
    public  StrBuilderreplaceFirst(StrMatcher matcher, String replaceStr)
         Replaces the first match within the builder with the replace string.
    public  StrBuilderreverse()
         Reverses the string builder placing each character in the opposite index.
    public  StringrightString(int length)
         Extracts the rightmost characters from the string builder without throwing an exception.

    This method extracts the right length characters from the builder.

    public  StrBuildersetCharAt(int index, char ch)
         Sets the character at the specified index.
    public  StrBuildersetLength(int length)
         Updates the length of the builder by either dropping the last characters or adding filler of unicode zero.
    public  StrBuildersetNewLineText(String newLine)
         Sets the text to be appended when a new line is added.
    public  StrBuildersetNullText(String nullText)
         Sets the text to be appended when null is added.
    public  intsize()
         Gets the length of the string builder.
    public  booleanstartsWith(String str)
         Checks whether this builder starts with the specified string.
    public  Stringsubstring(int start)
         Extracts a portion of this string builder as a string.
    public  Stringsubstring(int startIndex, int endIndex)
         Extracts a portion of this string builder as a string.
    public  char[]toCharArray()
         Copies the builder's character array into a new character array.
    public  char[]toCharArray(int startIndex, int endIndex)
         Copies part of the builder's character array into a new character array.
    public  StringtoString()
         Gets a String version of the string builder, creating a new instance each time the method is called.
    public  StringBuffertoStringBuffer()
         Gets a StringBuffer version of the string builder, creating a new instance each time the method is called.
    public  StrBuildertrim()
         Trims the builder by removing characters less than or equal to a space from the beginning and end.
    protected  voidvalidateIndex(int index)
         Validates parameters defining a single index in the builder.
    protected  intvalidateRange(int startIndex, int endIndex)
         Validates parameters defining a range of the builder.

    Field Detail
    CAPACITY
    final static int CAPACITY(Code)
    The extra capacity for new builders.



    buffer
    protected char[] buffer(Code)
    Internal data storage.



    size
    protected int size(Code)
    Current size of the buffer.




    Constructor Detail
    StrBuilder
    public StrBuilder()(Code)
    Constructor that creates an empty builder initial capacity 32 characters.



    StrBuilder
    public StrBuilder(int initialCapacity)(Code)
    Constructor that creates an empty builder the specified initial capacity.
    Parameters:
      initialCapacity - the initial capacity, zero or less will be converted to 32



    StrBuilder
    public StrBuilder(String str)(Code)
    Constructor that creates a builder from the string, allocating 32 extra characters for growth.
    Parameters:
      str - the string to copy, null treated as blank string




    Method Detail
    append
    public StrBuilder append(Object obj)(Code)
    Appends an object to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      obj - the object to append this, to enable chaining



    append
    public StrBuilder append(String str)(Code)
    Appends a string to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append this, to enable chaining



    append
    public StrBuilder append(String str, int startIndex, int length)(Code)
    Appends part of a string to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining



    append
    public StrBuilder append(StringBuffer str)(Code)
    Appends a string buffer to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string buffer to append this, to enable chaining



    append
    public StrBuilder append(StringBuffer str, int startIndex, int length)(Code)
    Appends part of a string buffer to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining



    append
    public StrBuilder append(StrBuilder str)(Code)
    Appends another string builder to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string builder to append this, to enable chaining



    append
    public StrBuilder append(StrBuilder str, int startIndex, int length)(Code)
    Appends part of a string builder to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining



    append
    public StrBuilder append(char[] chars)(Code)
    Appends a char array to the string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      chars - the char array to append this, to enable chaining



    append
    public StrBuilder append(char[] chars, int startIndex, int length)(Code)
    Appends a char array to the string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      chars - the char array to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining



    append
    public StrBuilder append(boolean value)(Code)
    Appends a boolean value to the string builder.
    Parameters:
      value - the value to append this, to enable chaining



    append
    public StrBuilder append(char ch)(Code)
    Appends a char value to the string builder.
    Parameters:
      ch - the value to append this, to enable chaining



    append
    public StrBuilder append(int value)(Code)
    Appends an int value to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining



    append
    public StrBuilder append(long value)(Code)
    Appends a long value to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining



    append
    public StrBuilder append(float value)(Code)
    Appends a float value to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining



    append
    public StrBuilder append(double value)(Code)
    Appends a double value to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining



    appendAll
    public StrBuilder appendAll(Object[] array)(Code)
    Appends each item in an array to the builder without any separators. Appending a null array will have no effect. Each object is appended using StrBuilder.append(Object) .
    Parameters:
      array - the array to append this, to enable chaining
    since:
       2.3



    appendAll
    public StrBuilder appendAll(Collection coll)(Code)
    Appends each item in a collection to the builder without any separators. Appending a null collection will have no effect. Each object is appended using StrBuilder.append(Object) .
    Parameters:
      coll - the collection to append this, to enable chaining
    since:
       2.3



    appendAll
    public StrBuilder appendAll(Iterator it)(Code)
    Appends each item in an iterator to the builder without any separators. Appending a null iterator will have no effect. Each object is appended using StrBuilder.append(Object) .
    Parameters:
      it - the iterator to append this, to enable chaining
    since:
       2.3



    appendFixedWidthPadLeft
    public StrBuilder appendFixedWidthPadLeft(Object obj, int width, char padChar)(Code)
    Appends an object to the builder padding on the left to a fixed width. The toString of the object is used. If the object is larger than the length, the left hand side is lost. If the object is null, the null text value is used.
    Parameters:
      obj - the object to append, null uses null text
    Parameters:
      width - the fixed field width, zero or negative has no effect
    Parameters:
      padChar - the pad character to use this, to enable chaining



    appendFixedWidthPadLeft
    public StrBuilder appendFixedWidthPadLeft(int value, int width, char padChar)(Code)
    Appends an object to the builder padding on the left to a fixed width. The String.valueOf of the int value is used. If the formatted value is larger than the length, the left hand side is lost.
    Parameters:
      value - the value to append
    Parameters:
      width - the fixed field width, zero or negative has no effect
    Parameters:
      padChar - the pad character to use this, to enable chaining



    appendFixedWidthPadRight
    public StrBuilder appendFixedWidthPadRight(Object obj, int width, char padChar)(Code)
    Appends an object to the builder padding on the right to a fixed length. The toString of the object is used. If the object is larger than the length, the right hand side is lost. If the object is null, null text value is used.
    Parameters:
      obj - the object to append, null uses null text
    Parameters:
      width - the fixed field width, zero or negative has no effect
    Parameters:
      padChar - the pad character to use this, to enable chaining



    appendFixedWidthPadRight
    public StrBuilder appendFixedWidthPadRight(int value, int width, char padChar)(Code)
    Appends an object to the builder padding on the right to a fixed length. The String.valueOf of the int value is used. If the object is larger than the length, the right hand side is lost.
    Parameters:
      value - the value to append
    Parameters:
      width - the fixed field width, zero or negative has no effect
    Parameters:
      padChar - the pad character to use this, to enable chaining



    appendNewLine
    public StrBuilder appendNewLine()(Code)
    Appends the new line string to this string builder.

    The new line string can be altered using StrBuilder.setNewLineText(String) . This might be used to force the output to always use Unix line endings even when on Windows. this, to enable chaining




    appendNull
    public StrBuilder appendNull()(Code)
    Appends the text representing null to this string builder. this, to enable chaining



    appendPadding
    public StrBuilder appendPadding(int length, char padChar)(Code)
    Appends the pad character to the builder the specified number of times.
    Parameters:
      length - the length to append, negative means no append
    Parameters:
      padChar - the character to append this, to enable chaining



    appendSeparator
    public StrBuilder appendSeparator(String separator)(Code)
    Appends a separator if the builder is currently non-empty. Appending a null separator will have no effect. The separator is appended using StrBuilder.append(String) .

    This method is useful for adding a separator each time around the loop except the first.

     for (Iterator it = list.iterator(); it.hasNext(); ) {
     appendSeparator(",");
     append(it.next());
     }
     
    Note that for this simple example, you should use StrBuilder.appendWithSeparators(Collection,String) .
    Parameters:
      separator - the separator to use, null means no separator this, to enable chaining
    since:
       2.3



    appendSeparator
    public StrBuilder appendSeparator(char separator)(Code)
    Appends a separator if the builder is currently non-empty. The separator is appended using StrBuilder.append(char) .

    This method is useful for adding a separator each time around the loop except the first.

     for (Iterator it = list.iterator(); it.hasNext(); ) {
     appendSeparator(',');
     append(it.next());
     }
     
    Note that for this simple example, you should use StrBuilder.appendWithSeparators(Collection,String) .
    Parameters:
      separator - the separator to use this, to enable chaining
    since:
       2.3



    appendSeparator
    public StrBuilder appendSeparator(String separator, int loopIndex)(Code)
    Appends a separator to the builder if the loop index is greater than zero. Appending a null separator will have no effect. The separator is appended using StrBuilder.append(String) .

    This method is useful for adding a separator each time around the loop except the first.

     for (int i = 0; i < list.size(); i++) {
     appendSeparator(",", i);
     append(list.get(i));
     }
     
    Note that for this simple example, you should use StrBuilder.appendWithSeparators(Collection,String) .
    Parameters:
      separator - the separator to use, null means no separator
    Parameters:
      loopIndex - the loop index this, to enable chaining
    since:
       2.3



    appendSeparator
    public StrBuilder appendSeparator(char separator, int loopIndex)(Code)
    Appends a separator to the builder if the loop index is greater than zero. The separator is appended using StrBuilder.append(char) .

    This method is useful for adding a separator each time around the loop except the first.

     for (int i = 0; i < list.size(); i++) {
     appendSeparator(",", i);
     append(list.get(i));
     }
     
    Note that for this simple example, you should use StrBuilder.appendWithSeparators(Collection,String) .
    Parameters:
      separator - the separator to use
    Parameters:
      loopIndex - the loop index this, to enable chaining
    since:
       2.3



    appendWithSeparators
    public StrBuilder appendWithSeparators(Object[] array, String separator)(Code)
    Appends an array placing separators between each value, but not before the first or after the last. Appending a null array will have no effect. Each object is appended using StrBuilder.append(Object) .
    Parameters:
      array - the array to append
    Parameters:
      separator - the separator to use, null means no separator this, to enable chaining



    appendWithSeparators
    public StrBuilder appendWithSeparators(Collection coll, String separator)(Code)
    Appends a collection placing separators between each value, but not before the first or after the last. Appending a null collection will have no effect. Each object is appended using StrBuilder.append(Object) .
    Parameters:
      coll - the collection to append
    Parameters:
      separator - the separator to use, null means no separator this, to enable chaining



    appendWithSeparators
    public StrBuilder appendWithSeparators(Iterator it, String separator)(Code)
    Appends an iterator placing separators between each value, but not before the first or after the last. Appending a null iterator will have no effect. Each object is appended using StrBuilder.append(Object) .
    Parameters:
      it - the iterator to append
    Parameters:
      separator - the separator to use, null means no separator this, to enable chaining



    appendln
    public StrBuilder appendln(Object obj)(Code)
    Appends an object followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      obj - the object to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(String str)(Code)
    Appends a string followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(String str, int startIndex, int length)(Code)
    Appends part of a string followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(StringBuffer str)(Code)
    Appends a string buffer followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string buffer to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(StringBuffer str, int startIndex, int length)(Code)
    Appends part of a string buffer followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(StrBuilder str)(Code)
    Appends another string builder followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string builder to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(StrBuilder str, int startIndex, int length)(Code)
    Appends part of a string builder followed by a new line to this string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      str - the string to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(char[] chars)(Code)
    Appends a char array followed by a new line to the string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      chars - the char array to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(char[] chars, int startIndex, int length)(Code)
    Appends a char array followed by a new line to the string builder. Appending null will call StrBuilder.appendNull() .
    Parameters:
      chars - the char array to append
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      length - the length to append, must be valid this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(boolean value)(Code)
    Appends a boolean value followed by a new line to the string builder.
    Parameters:
      value - the value to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(char ch)(Code)
    Appends a char value followed by a new line to the string builder.
    Parameters:
      ch - the value to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(int value)(Code)
    Appends an int value followed by a new line to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(long value)(Code)
    Appends a long value followed by a new line to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(float value)(Code)
    Appends a float value followed by a new line to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining
    since:
       2.3



    appendln
    public StrBuilder appendln(double value)(Code)
    Appends a double value followed by a new line to the string builder using String.valueOf.
    Parameters:
      value - the value to append this, to enable chaining
    since:
       2.3



    asReader
    public Reader asReader()(Code)
    Gets the contents of this builder as a Reader.

    This method allows the contents of the builder to be read using any standard method that expects a Reader.

    To use, simply create a StrBuilder, populate it with data, call asReader, and then read away.

    The internal character array is shared between the builder and the reader. This allows you to append to the builder after creating the reader, and the changes will be picked up. Note however, that no synchronization occurs, so you must perform all operations with the builder and the reader in one thread.

    The returned reader supports marking, and ignores the flush method. a reader that reads from this builder




    asTokenizer
    public StrTokenizer asTokenizer()(Code)
    Creates a tokenizer that can tokenize the contents of this builder.

    This method allows the contents of this builder to be tokenized. The tokenizer will be setup by default to tokenize on space, tab, newline and formfeed (as per StringTokenizer). These values can be changed on the tokenizer class, before retrieving the tokens.

    The returned tokenizer is linked to this builder. You may intermix calls to the buider and tokenizer within certain limits, however there is no synchronization. Once the tokenizer has been used once, it must be StrTokenizer.reset reset to pickup the latest changes in the builder. For example:

     StrBuilder b = new StrBuilder();
     b.append("a b ");
     StrTokenizer t = b.asTokenizer();
     String[] tokens1 = t.getTokenArray();  // returns a,b
     b.append("c d ");
     String[] tokens2 = t.getTokenArray();  // returns a,b (c and d ignored)
     t.reset();              // reset causes builder changes to be picked up
     String[] tokens3 = t.getTokenArray();  // returns a,b,c,d
     
    In addition to simply intermixing appends and tokenization, you can also call the set methods on the tokenizer to alter how it tokenizes. Just remember to call reset when you want to pickup builder changes.

    Calling StrTokenizer.reset(String) or StrTokenizer.reset(char[]) with a non-null value will break the link with the builder. a tokenizer that is linked to this builder




    asWriter
    public Writer asWriter()(Code)
    Gets this builder as a Writer that can be written to.

    This method allows you to populate the contents of the builder using any standard method that takes a Writer.

    To use, simply create a StrBuilder, call asWriter, and populate away. The data is available at any time using the methods of the StrBuilder.

    The internal character array is shared between the builder and the writer. This allows you to intermix calls that append to the builder and write using the writer and the changes will be occur correctly. Note however, that no synchronization occurs, so you must perform all operations with the builder and the writer in one thread.

    The returned writer ignores the close and flush methods. a writer that populates this builder




    capacity
    public int capacity()(Code)
    Gets the current size of the internal character array buffer. the capacity



    charAt
    public char charAt(int index)(Code)
    Gets the character at the specified index.
    See Also:   StrBuilder.setCharAt(int,char)
    See Also:   StrBuilder.deleteCharAt(int)
    Parameters:
      index - the index to retrieve, must be valid the character at the index
    throws:
      IndexOutOfBoundsException - if the index is invalid



    clear
    public StrBuilder clear()(Code)
    Clears the string builder (convenience Collections API style method).

    This method does not reduce the size of the internal character buffer. To do that, call clear() followed by StrBuilder.minimizeCapacity() .

    This method is the same as StrBuilder.setLength(int) called with zero and is provided to match the API of Collections. this, to enable chaining




    contains
    public boolean contains(char ch)(Code)
    Checks if the string builder contains the specified char.
    Parameters:
      ch - the character to find true if the builder contains the character



    contains
    public boolean contains(String str)(Code)
    Checks if the string builder contains the specified string.
    Parameters:
      str - the string to find true if the builder contains the string



    contains
    public boolean contains(StrMatcher matcher)(Code)
    Checks if the string builder contains a string matched using the specified matcher.

    Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to search for the character 'a' followed by a number.
    Parameters:
      matcher - the matcher to use, null returns -1 true if the matcher finds a match in the builder




    delete
    public StrBuilder delete(int startIndex, int endIndex)(Code)
    Deletes the characters between the two specified indices.
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      endIndex - the end index, exclusive, must be valid exceptthat if too large it is treated as end of string this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    deleteAll
    public StrBuilder deleteAll(char ch)(Code)
    Deletes the character wherever it occurs in the builder.
    Parameters:
      ch - the character to delete this, to enable chaining



    deleteAll
    public StrBuilder deleteAll(String str)(Code)
    Deletes the string wherever it occurs in the builder.
    Parameters:
      str - the string to delete, null causes no action this, to enable chaining



    deleteAll
    public StrBuilder deleteAll(StrMatcher matcher)(Code)
    Deletes all parts of the builder that the matcher matches.

    Matchers can be used to perform advanced deletion behaviour. For example you could write a matcher to delete all occurances where the character 'a' is followed by a number.
    Parameters:
      matcher - the matcher to use to find the deletion, null causes no action this, to enable chaining




    deleteCharAt
    public StrBuilder deleteCharAt(int index)(Code)
    Deletes the character at the specified index.
    See Also:   StrBuilder.charAt(int)
    See Also:   StrBuilder.setCharAt(int,char)
    Parameters:
      index - the index to delete this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    deleteFirst
    public StrBuilder deleteFirst(char ch)(Code)
    Deletes the character wherever it occurs in the builder.
    Parameters:
      ch - the character to delete this, to enable chaining



    deleteFirst
    public StrBuilder deleteFirst(String str)(Code)
    Deletes the string wherever it occurs in the builder.
    Parameters:
      str - the string to delete, null causes no action this, to enable chaining



    deleteFirst
    public StrBuilder deleteFirst(StrMatcher matcher)(Code)
    Deletes the first match within the builder using the specified matcher.

    Matchers can be used to perform advanced deletion behaviour. For example you could write a matcher to delete where the character 'a' is followed by a number.
    Parameters:
      matcher - the matcher to use to find the deletion, null causes no action this, to enable chaining




    endsWith
    public boolean endsWith(String str)(Code)
    Checks whether this builder ends with the specified string.

    Note that this method handles null input quietly, unlike String.
    Parameters:
      str - the string to search for, null returns false true if the builder ends with the string




    ensureCapacity
    public StrBuilder ensureCapacity(int capacity)(Code)
    Checks the capacity and ensures that it is at least the size specified.
    Parameters:
      capacity - the capacity to ensure this, to enable chaining



    equals
    public boolean equals(StrBuilder other)(Code)
    Checks the contents of this builder against another to see if they contain the same character content.
    Parameters:
      other - the object to check, null returns false true if the builders contain the same characters in the same order



    equals
    public boolean equals(Object obj)(Code)
    Checks the contents of this builder against another to see if they contain the same character content.
    Parameters:
      obj - the object to check, null returns false true if the builders contain the same characters in the same order



    equalsIgnoreCase
    public boolean equalsIgnoreCase(StrBuilder other)(Code)
    Checks the contents of this builder against another to see if they contain the same character content ignoring case.
    Parameters:
      other - the object to check, null returns false true if the builders contain the same characters in the same order



    getChars
    public char[] getChars(char[] destination)(Code)
    Copies the character array into the specified array.
    Parameters:
      destination - the destination array, null will cause an array to be created the input array, unless that was null or too small



    getChars
    public void getChars(int startIndex, int endIndex, char destination, int destinationIndex)(Code)
    Copies the character array into the specified array.
    Parameters:
      startIndex - first index to copy, inclusive, must be valid
    Parameters:
      endIndex - last index, exclusive, must be valid
    Parameters:
      destination - the destination array, must not be null or too small
    Parameters:
      destinationIndex - the index to start copying in destination
    throws:
      NullPointerException - if the array is null
    throws:
      IndexOutOfBoundsException - if any index is invalid



    getNewLineText
    public String getNewLineText()(Code)
    Gets the text to be appended when a new line is added. the new line text, null means use system default



    getNullText
    public String getNullText()(Code)
    Gets the text to be appended when null is added. the null text, null means no append



    hashCode
    public int hashCode()(Code)
    Gets a suitable hash code for this builder. a hash code



    indexOf
    public int indexOf(char ch)(Code)
    Searches the string builder to find the first reference to the specified char.
    Parameters:
      ch - the character to find the first index of the character, or -1 if not found



    indexOf
    public int indexOf(char ch, int startIndex)(Code)
    Searches the string builder to find the first reference to the specified char.
    Parameters:
      ch - the character to find
    Parameters:
      startIndex - the index to start at, invalid index rounded to edge the first index of the character, or -1 if not found



    indexOf
    public int indexOf(String str)(Code)
    Searches the string builder to find the first reference to the specified string.

    Note that a null input string will return -1, whereas the JDK throws an exception.
    Parameters:
      str - the string to find, null returns -1 the first index of the string, or -1 if not found




    indexOf
    public int indexOf(String str, int startIndex)(Code)
    Searches the string builder to find the first reference to the specified string starting searching from the given index.

    Note that a null input string will return -1, whereas the JDK throws an exception.
    Parameters:
      str - the string to find, null returns -1
    Parameters:
      startIndex - the index to start at, invalid index rounded to edge the first index of the string, or -1 if not found




    indexOf
    public int indexOf(StrMatcher matcher)(Code)
    Searches the string builder using the matcher to find the first match.

    Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to find the character 'a' followed by a number.
    Parameters:
      matcher - the matcher to use, null returns -1 the first index matched, or -1 if not found




    indexOf
    public int indexOf(StrMatcher matcher, int startIndex)(Code)
    Searches the string builder using the matcher to find the first match searching from the given index.

    Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to find the character 'a' followed by a number.
    Parameters:
      matcher - the matcher to use, null returns -1
    Parameters:
      startIndex - the index to start at, invalid index rounded to edge the first index matched, or -1 if not found




    insert
    public StrBuilder insert(int index, Object obj)(Code)
    Inserts the string representation of an object into this builder. Inserting null will use the stored null text value.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      obj - the object to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, String str)(Code)
    Inserts the string into this builder. Inserting null will use the stored null text value.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      str - the string to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, char chars)(Code)
    Inserts the character array into this builder. Inserting null will use the stored null text value.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      chars - the char array to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, char chars, int offset, int length)(Code)
    Inserts part of the character array into this builder. Inserting null will use the stored null text value.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      chars - the char array to insert
    Parameters:
      offset - the offset into the character array to start at, must be valid
    Parameters:
      length - the length of the character array part to copy, must be positive this, to enable chaining
    throws:
      IndexOutOfBoundsException - if any index is invalid



    insert
    public StrBuilder insert(int index, boolean value)(Code)
    Inserts the value into this builder.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      value - the value to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, char value)(Code)
    Inserts the value into this builder.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      value - the value to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, int value)(Code)
    Inserts the value into this builder.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      value - the value to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, long value)(Code)
    Inserts the value into this builder.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      value - the value to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, float value)(Code)
    Inserts the value into this builder.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      value - the value to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    insert
    public StrBuilder insert(int index, double value)(Code)
    Inserts the value into this builder.
    Parameters:
      index - the index to add at, must be valid
    Parameters:
      value - the value to insert this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    isEmpty
    public boolean isEmpty()(Code)
    Checks is the string builder is empty (convenience Collections API style method).

    This method is the same as checking StrBuilder.length() and is provided to match the API of Collections. true if the size is 0.




    lastIndexOf
    public int lastIndexOf(char ch)(Code)
    Searches the string builder to find the last reference to the specified char.
    Parameters:
      ch - the character to find the last index of the character, or -1 if not found



    lastIndexOf
    public int lastIndexOf(char ch, int startIndex)(Code)
    Searches the string builder to find the last reference to the specified char.
    Parameters:
      ch - the character to find
    Parameters:
      startIndex - the index to start at, invalid index rounded to edge the last index of the character, or -1 if not found



    lastIndexOf
    public int lastIndexOf(String str)(Code)
    Searches the string builder to find the last reference to the specified string.

    Note that a null input string will return -1, whereas the JDK throws an exception.
    Parameters:
      str - the string to find, null returns -1 the last index of the string, or -1 if not found




    lastIndexOf
    public int lastIndexOf(String str, int startIndex)(Code)
    Searches the string builder to find the last reference to the specified string starting searching from the given index.

    Note that a null input string will return -1, whereas the JDK throws an exception.
    Parameters:
      str - the string to find, null returns -1
    Parameters:
      startIndex - the index to start at, invalid index rounded to edge the last index of the string, or -1 if not found




    lastIndexOf
    public int lastIndexOf(StrMatcher matcher)(Code)
    Searches the string builder using the matcher to find the last match.

    Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to find the character 'a' followed by a number.
    Parameters:
      matcher - the matcher to use, null returns -1 the last index matched, or -1 if not found




    lastIndexOf
    public int lastIndexOf(StrMatcher matcher, int startIndex)(Code)
    Searches the string builder using the matcher to find the last match searching from the given index.

    Matchers can be used to perform advanced searching behaviour. For example you could write a matcher to find the character 'a' followed by a number.
    Parameters:
      matcher - the matcher to use, null returns -1
    Parameters:
      startIndex - the index to start at, invalid index rounded to edge the last index matched, or -1 if not found




    leftString
    public String leftString(int length)(Code)
    Extracts the leftmost characters from the string builder without throwing an exception.

    This method extracts the left length characters from the builder. If this many characters are not available, the whole builder is returned. Thus the returned string may be shorter than the length requested.
    Parameters:
      length - the number of characters to extract, negative returns empty string the new string




    length
    public int length()(Code)
    Gets the length of the string builder. the length



    midString
    public String midString(int index, int length)(Code)
    Extracts some characters from the middle of the string builder without throwing an exception.

    This method extracts length characters from the builder at the specified index. If the index is negative it is treated as zero. If the index is greater than the builder size, it is treated as the builder size. If the length is negative, the empty string is returned. If insufficient characters are available in the builder, as much as possible is returned. Thus the returned string may be shorter than the length requested.
    Parameters:
      index - the index to start at, negative means zero
    Parameters:
      length - the number of characters to extract, negative returns empty string the new string




    minimizeCapacity
    public StrBuilder minimizeCapacity()(Code)
    Minimizes the capacity to the actual length of the string. this, to enable chaining



    replace
    public StrBuilder replace(int startIndex, int endIndex, String replaceStr)(Code)
    Replaces a portion of the string builder with another string. The length of the inserted string does not have to match the removed length.
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      endIndex - the end index, exclusive, must be valid exceptthat if too large it is treated as end of string
    Parameters:
      replaceStr - the string to replace with, null means delete range this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    replace
    public StrBuilder replace(StrMatcher matcher, String replaceStr, int startIndex, int endIndex, int replaceCount)(Code)
    Advanced search and replaces within the builder using a matcher.

    Matchers can be used to perform advanced behaviour. For example you could write a matcher to delete all occurances where the character 'a' is followed by a number.
    Parameters:
      matcher - the matcher to use to find the deletion, null causes no action
    Parameters:
      replaceStr - the string to replace the match with, null is a delete
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      endIndex - the end index, exclusive, must be valid exceptthat if too large it is treated as end of string
    Parameters:
      replaceCount - the number of times to replace, -1 for replace all this, to enable chaining
    throws:
      IndexOutOfBoundsException - if start index is invalid




    replaceAll
    public StrBuilder replaceAll(char search, char replace)(Code)
    Replaces the search character with the replace character throughout the builder.
    Parameters:
      search - the search character
    Parameters:
      replace - the replace character this, to enable chaining



    replaceAll
    public StrBuilder replaceAll(String searchStr, String replaceStr)(Code)
    Replaces the search string with the replace string throughout the builder.
    Parameters:
      searchStr - the search string, null causes no action to occur
    Parameters:
      replaceStr - the replace string, null is equivalent to an empty string this, to enable chaining



    replaceAll
    public StrBuilder replaceAll(StrMatcher matcher, String replaceStr)(Code)
    Replaces all matches within the builder with the replace string.

    Matchers can be used to perform advanced replace behaviour. For example you could write a matcher to replace all occurances where the character 'a' is followed by a number.
    Parameters:
      matcher - the matcher to use to find the deletion, null causes no action
    Parameters:
      replaceStr - the replace string, null is equivalent to an empty string this, to enable chaining




    replaceFirst
    public StrBuilder replaceFirst(char search, char replace)(Code)
    Replaces the first instance of the search character with the replace character in the builder.
    Parameters:
      search - the search character
    Parameters:
      replace - the replace character this, to enable chaining



    replaceFirst
    public StrBuilder replaceFirst(String searchStr, String replaceStr)(Code)
    Replaces the first instance of the search string with the replace string.
    Parameters:
      searchStr - the search string, null causes no action to occur
    Parameters:
      replaceStr - the replace string, null is equivalent to an empty string this, to enable chaining



    replaceFirst
    public StrBuilder replaceFirst(StrMatcher matcher, String replaceStr)(Code)
    Replaces the first match within the builder with the replace string.

    Matchers can be used to perform advanced replace behaviour. For example you could write a matcher to replace where the character 'a' is followed by a number.
    Parameters:
      matcher - the matcher to use to find the deletion, null causes no action
    Parameters:
      replaceStr - the replace string, null is equivalent to an empty string this, to enable chaining




    reverse
    public StrBuilder reverse()(Code)
    Reverses the string builder placing each character in the opposite index. this, to enable chaining



    rightString
    public String rightString(int length)(Code)
    Extracts the rightmost characters from the string builder without throwing an exception.

    This method extracts the right length characters from the builder. If this many characters are not available, the whole builder is returned. Thus the returned string may be shorter than the length requested.
    Parameters:
      length - the number of characters to extract, negative returns empty string the new string




    setCharAt
    public StrBuilder setCharAt(int index, char ch)(Code)
    Sets the character at the specified index.
    See Also:   StrBuilder.charAt(int)
    See Also:   StrBuilder.deleteCharAt(int)
    Parameters:
      index - the index to set
    Parameters:
      ch - the new character this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the index is invalid



    setLength
    public StrBuilder setLength(int length)(Code)
    Updates the length of the builder by either dropping the last characters or adding filler of unicode zero.
    Parameters:
      length - the length to set to, must be zero or positive this, to enable chaining
    throws:
      IndexOutOfBoundsException - if the length is negative



    setNewLineText
    public StrBuilder setNewLineText(String newLine)(Code)
    Sets the text to be appended when a new line is added.
    Parameters:
      newLine - the new line text, null means use system default this, to enable chaining



    setNullText
    public StrBuilder setNullText(String nullText)(Code)
    Sets the text to be appended when null is added.
    Parameters:
      nullText - the null text, null means no append this, to enable chaining



    size
    public int size()(Code)
    Gets the length of the string builder.

    This method is the same as StrBuilder.length() and is provided to match the API of Collections. the length




    startsWith
    public boolean startsWith(String str)(Code)
    Checks whether this builder starts with the specified string.

    Note that this method handles null input quietly, unlike String.
    Parameters:
      str - the string to search for, null returns false true if the builder starts with the string




    substring
    public String substring(int start)(Code)
    Extracts a portion of this string builder as a string.
    Parameters:
      start - the start index, inclusive, must be valid the new string
    throws:
      IndexOutOfBoundsException - if the index is invalid



    substring
    public String substring(int startIndex, int endIndex)(Code)
    Extracts a portion of this string builder as a string.

    Note: This method treats an endIndex greater than the length of the builder as equal to the length of the builder, and continues without error, unlike StringBuffer or String.
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      endIndex - the end index, exclusive, must be valid exceptthat if too large it is treated as end of string the new string
    throws:
      IndexOutOfBoundsException - if the index is invalid




    toCharArray
    public char[] toCharArray()(Code)
    Copies the builder's character array into a new character array. a new array that represents the contents of the builder



    toCharArray
    public char[] toCharArray(int startIndex, int endIndex)(Code)
    Copies part of the builder's character array into a new character array.
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      endIndex - the end index, exclusive, must be valid except thatif too large it is treated as end of string a new array that holds part of the contents of the builder
    throws:
      IndexOutOfBoundsException - if startIndex is invalid,or if endIndex is invalid (but endIndex greater than size is valid)



    toString
    public String toString()(Code)
    Gets a String version of the string builder, creating a new instance each time the method is called.

    Note that unlike StringBuffer, the string version returned is independent of the string builder. the builder as a String




    toStringBuffer
    public StringBuffer toStringBuffer()(Code)
    Gets a StringBuffer version of the string builder, creating a new instance each time the method is called. the builder as a StringBuffer



    trim
    public StrBuilder trim()(Code)
    Trims the builder by removing characters less than or equal to a space from the beginning and end. this, to enable chaining



    validateIndex
    protected void validateIndex(int index)(Code)
    Validates parameters defining a single index in the builder.
    Parameters:
      index - the index, must be valid
    throws:
      IndexOutOfBoundsException - if the index is invalid



    validateRange
    protected int validateRange(int startIndex, int endIndex)(Code)
    Validates parameters defining a range of the builder.
    Parameters:
      startIndex - the start index, inclusive, must be valid
    Parameters:
      endIndex - the end index, exclusive, must be valid exceptthat if too large it is treated as end of string the new string
    throws:
      IndexOutOfBoundsException - if the index is invalid



    Methods inherited from java.lang.Object
    native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
    public boolean equals(Object obj)(Code)(Java Doc)
    protected void finalize() throws Throwable(Code)(Java Doc)
    final native public Class getClass()(Code)(Java Doc)
    native public int hashCode()(Code)(Java Doc)
    final native public void notify()(Code)(Java Doc)
    final native public void notifyAll()(Code)(Java Doc)
    public String toString()(Code)(Java Doc)
    final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
    final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
    final public void wait() throws InterruptedException(Code)(Java Doc)

    www.java2java.com | Contact Us
    Copyright 2009 - 12 Demo Source and Support. All rights reserved.
    All other trademarks are property of their respective owners.