JS: Make StringBuilder implement CharSequence and introduce secondary constructors.

This commit is contained in:
Ilya Gorbunov
2015-10-14 07:40:57 +03:00
parent 935024db4e
commit d860f335a3
3 changed files with 57 additions and 3 deletions
+13 -2
View File
@@ -1029,9 +1029,20 @@
Kotlin.StringBuilder = Kotlin.createClassNow(null,
function () {
this.string = "";
function (content) {
this.string = typeof(content) == "string" ? content : "";
}, {
length: {
get: function() {
return this.string.length;
}
},
substring: function(start, end) {
return this.string.substring(start, end);
},
charAt: function(index) {
return this.string.charAt(index);
},
append: function (obj, from, to) {
if (from == void 0 && to == void 0) {
this.string = this.string + obj.toString();