Connecting to a Database and Strings Handling

Constructing a StringIf you are constructing a string with several appends, it may be more efficient to construct it using a StringBuffer and then convert it to an immutable String object.StringBuffer buf = new StringBuffer("Initial Text");// Modifyint index = 1;buf.insert(index, "abc");buf.append("def");// Convert to stringString s = buf.toString();Getting a Substring from a Stringint start = 1;int end = 4;String substr = "aString".substring(start, end); // Str

 

This Question is not yet answered!

 
 

Related Answered Questions

 

Related Open Questions