Get Sub string from StringBuilder

ReturnMethodSummary
CharSequencesubSequence(int start, int end)Returns a new character sequence that is a subsequence of this sequence.
Stringsubstring(int start)Returns a new String that contains a subsequence of characters currently contained in this character sequence.
Stringsubstring(int start, int end)Returns a new String that contains a subsequence of characters currently contained in this sequence.

public class Main {
  public static void main(String[] argv) {
    StringBuilder sb = new StringBuilder();
    sb.append("java2s.com");

    System.out.println(sb.substring(3));
  }
}

The output:


a2s.com
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.