3

I am doing an angular2 application and there I have to use StringBuilder. So I have to know How to use the string builder and how to append to it.

var sb = new StringBuilder();
var sResult = "";
$(arrayWidgets).each(function (index) {
    if (arrayWidgets[index] != "") {
        sb.append("<div class='EachWidget FL'>");
        sb.append("</div>");
    }
});

This is the code in Javascript

StringBuilder Code

var StringBuilder = function () { this.value = ""; };
StringBuilder.prototype.append = function (value) { this.value += value; };
StringBuilder.prototype.toString = function () { return this.value; };
2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.