StringBuffer.js 246 B

1234567891011121314
  1. export default class StringBuffer {
  2. constructor(str) {
  3. this.str = str
  4. }
  5. append(e) {
  6. this.str += e
  7. }
  8. setCharAt(i, c) {
  9. this.str = this.str.substr(0, i) + c + this.str.substr(i + 1)
  10. }
  11. toString() {
  12. return this.str
  13. }
  14. }