String truncate End - Node.js String

Node.js examples for String:sub string

Description

String truncate End

Demo Code

String.prototype.truncateEnd = function k(p, o) {
    if (p >= this.length) {
        return this
    }/*from   w w w .j ava 2s . c  o m*/
    if (o === undefined) {
        o = "..."
    }
    return this.substring(0, (p - o.length)) + o
};

Related Tutorials