Remove substring from StringBuilder
public class Main {
public static void main(String[] args) {
StringBuilder lipsum = new StringBuilder("Lorem ipsum dolor sit amet.");
System.out.println("lipsum = " + lipsum.toString());
lipsum.delete(0, 28);
System.out.println("lipsum = " + lipsum.toString());
lipsum.deleteCharAt(lipsum.length() - 1);
System.out.println("lipsum = " + lipsum.toString());
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
StringBuilder:
- Check the capacity of StringBuilder object
- Delete text from StringBuilder
- Palindrome with StringBuilder
- Remove substring from StringBuilder