Inserting Strings : StringBuffer StringBuilder « Development « Java Tutorial

Java Tutorial
1. Language
2. Data Type
3. Operators
4. Statement Control
5. Class Definition
6. Development
7. Reflection
8. Regular Expressions
9. Collections
10. Thread
11. File
12. Generics
13. I18N
14. Swing
15. Swing Event
16. 2D Graphics
17. SWT
18. SWT 2D Graphics
19. Network
20. Database
21. Hibernate
22. JPA
23. JSP
24. JSTL
25. Servlet
26. Web Services SOA
27. EJB3
28. Spring
29. PDF
30. Email
31. J2ME
32. J2EE Application
33. XML
34. Design Pattern
35. Log
36. Security
37. Apache Common
38. Ant
39. JUnit
Java
Java Source Code / Java Documentation
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 Tutorial » Development » StringBuffer StringBuilder 
6. 15. 15. Inserting Strings
public class MainClass {

  public static void main(String[] arg) {
    StringBuffer phrase = new StringBuffer("one two three four");
    phrase.insert(4"old");
    
    System.out.println(phrase);
    
  }

}
one oldtwo three four
6. 15. StringBuffer StringBuilder
6. 15. 1. StringBuffer and StringBuilder
6. 15. 2. You can also create a StringBuffer object using a reference stored in a variable of type String:
6. 15. 3. Creating a String Object From a StringBuffer Object
6. 15. 4. Creating a StringBuffer object with a specific value for the capacity
6. 15. 5. Check the capacity of StringBuilder object
6. 15. 6. Adding String to a StringBuffer Object
6. 15. 7. The append() method returns a reference to the extended StringBuffer object
6. 15. 8. Calling append() method to construct a StringBuffer object
6. 15. 9. Appending a Substring: append part of the aString object to the buf object
6. 15. 10. Appending Basic Types: long, double
6. 15. 11. Appending a subset of the elements from a char array
6. 15. 12. StringBuffer methods charAt, setCharAt, getChars and reverse
6. 15. 13. StringBuffer methods insert, delete and deleteCharAt
6. 15. 14. Convert digit to character with Character.forDigit
6. 15. 15. Inserting Strings
6. 15. 16. The Length of a StringBuffer Object
6. 15. 17. Changing the StringBufer Length for a StringBuffer Object
6. 15. 18. To find out a StringBuffer object's capacity
6. 15. 19. The ensureCapacity() method changes the default capacity of a StringBuffer object
6. 15. 20. Finding the Position of a Substring
6. 15. 21. Specifying the index position in the buffer where the search is to start
6. 15. 22. Replacing a Substring in the Buffer
6. 15. 23. Extracting Characters From a Mutable String: charAt() and getChars() methods
6. 15. 24. Changing a single character in a StringBuffer object
6. 15. 25. Using the deleteCharAt() method to remove a character from a StringBuffer object at the index position
6. 15. 26. Removing several characters from a StringBuffer object
6. 15. 27. Remove substring from StringBuilder
6. 15. 28. Deletes text from the StringBuilder object
6. 15. 29. Reversing the sequence of characters in a StringBuffer object with the reverse() method
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.