Java Tutorial/String and Character Manipulation
< Java TutorialStrings
- String str = "abc"
- String str = "abc"+"def"
- String str = "abc".substring(2,3);
- charAt
- concat
- String.format
- indexOf
- length
- split
- substring
- String.valueOf
String builder
In Java, Strings are normally immutable objects - making a change necessitates creating a new String, which will be inefficient if you need to manipulate large amounts of text.
The StringBuidler class is designed for such instances.
The following methods are important for the string builder:
- append(addition): adds the value to the end of the string.
- charAt(index)
- delete(start, end)
- insert(offset, addition)
- length
- replace(start, end, str)
- toString
This article is issued from Wikiversity - version of the Saturday, July 18, 2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.