Professional Documents
Culture Documents
27-Sep-19 1
4 December 2017 1
27-Sep-19 1
Objectives
• Strings.
• String Operations.
• StringBuffer.
GMR Institute of Technology
• StringBuffer Operations.
Strings
the index within this string of the first occurrence of the specified
substring, starting at the specified index.
• public String
substring(int beginIndex,
int endIndex)
GMR Institute of Technology
S = “Hi Mom!”
– StringBuffer()
– StringBuffer(int size)
– StringBuffer(String str)
StringBuffer Operations
sb.charAt(1); // e
sb.setCharAt(1,’i’); // Hillo
sb.setLength(2); // Hi
sb.append(“l”).append(“l”); // Hill
sb.insert(0, “Big “); // Big Hill
Examples: StringBuffer
31