(function() {

  this.def_class('String',DObject,function(__scope,__class){

    if(!this.__ctor__){this.__ctor__= function String(){}; this.__ctor__.prototype = this.prototype; }

    this.prototype.size = function() {
      return this.length;
    }; __method_added(this,"size");

    this.prototype.len = function() {
      return this.length;
    }; __method_added(this,"len");

    this.prototype.to_i = function() {
      return parseInt(this);
    }; __method_added(this,"to_i");

    this.prototype.to_f = function() {
      return parseFloat(this);
    }; __method_added(this,"to_f");

    this.prototype.to_s = function() {
      return this.toString();
    }; __method_added(this,"to_s");

    this.prototype["[]"] = function(idx) {
      if (idx instanceof RegExp) {
        return this.match(idx);
      } else if (typeof idx === 'string') {
        if (this.indexOf(idx) >= 0) {
          return idx;
        } else {
          return null;
        }
      } else {
        return this[idx];
      }
    }; __method_added(this,"[]");

    this.prototype.downcase = function() {
      return this.toLowerCase();
    }; __method_added(this,"downcase");

    this.prototype.upcase = function() {
      return this.toUpperCase();
    }; __method_added(this,"upcase");

    this.prototype.pluralize = function() {
      return "" + this + "s";
    }; __method_added(this,"pluralize");

    this.prototype.camelcase = function() {
      var word, words;
      words = (function() {
        var _i, _len, _primitive, _ref, _results;
        _ref = this.split('_');
        _results = [];
        for (_i = 0, _len = (_ref.len ? _ref.len() : _ref.length),_primitive = (_ref instanceof Array || !_ref.at); _i < _len; _i++) {
          word = _primitive ? _ref[_i] : _ref.at(_i);
          _results.push(word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase());
        }
        return _results;
      }).call(this);
      return words.join("");
    }; __method_added(this,"camelcase");

    this.prototype.quoted = function() {
      if (this[0] === '"' && this[this.length - 1] === '"') {
        return this;
      } else if (this[0] === "'" && this[this.length - 1] === "'") {
        return this;
      } else {
        return '"' + this + '"';
      }
    }; __method_added(this,"quoted");

  });

}).call($$base);

