View file sys/javascript/sources/plugins/string.js

File size: 573B
String.prototype.trim = function(){
    return this.replace(/^\s+|\s+$/g, "");
};

    String.prototype.toCamel = function(){
        return this.replace(/(\-[a-z])/g, function($1){
            return $1.toUpperCase().replace('-','');
        });
    };

    String.prototype.toDash = function(){
        return this.replace(/([A-Z])/g, function($1){
            return "-"+$1.toLowerCase();
        });
    };

    String.prototype.toUnderscore = function(){
        return this.replace(/([A-Z])/g, function($1){
            return "_"+$1.toLowerCase();
        });
    };