Top community members
All Wiki Articles Create Wiki Article

In the past we had a dream,
to have place where we could share IT knowledge,
to ask questions without fear that someone will judge us.

Now we are a group of people who make this dream come true. ❤ 💻

If you think sharing knowledge and helping other is valuable.

join our community - Click here

Java - Remove last 2 characters from string builder in java

0 contributions
10 points

Remove last 2 characters from StringBuilder in Java

Syntax:

sb.delete(sb.length() - 2, sb.length());

Example:

StringBuilder sb = new StringBuilder();
sb.append("12345");
System.out.println(sb.toString()); // 12345
sb.delete(sb.length() - 2, sb.length());
System.out.println(sb.toString()); // 123

https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html

0 contributions

Suggested wiki articles:

Suggested findings

Let's do the work and have some fun
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way. ❤ 💻 🙂
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    we will help you. 👍 ✔ 🦄
Read more