5/12/2018 - 1:46 AM



  • normal methods:
  • length()


  • useful methods:
  • setCharAt(k, c)
  • insert(k,s): Insert a copy of string s starting at index k of the sequence, shifting existing characters further back to make room.
  • append(s)
  • reverse()
  • toString()
  • The reason we implement StringBuilder class in our program is that the time complexity of append something is O(1) instead of O(n) using append(s) to the String directly. Thus, it's convenient to modify string in this mode and convert back to String after changing.