/**
 * CFString
 * @author: Hiroshi Tazawa
 * @company: convexstyle.com
 * @copyright: convexstyle
 * @version: 1.0
 */


// Trim the string.
String.prototype.trim = function(str) {
	return str.replace(/(^\s+)|(\s+$)/g, '');
}

String.prototype.capitalize = function(){
   return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
};

String.prototype.isEmail = function() {
	var reqExp = new RegExp(/^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$/i);
	return reqExp.test(this);
}

String.prototype.isPhone = function() {
	var reqExp = new RegExp(/^[^a-zA-Z]{1,}/i);
	return reqExp.test(this);
}

String.prototype.notEmpty = function() {
	if(this.length == 0 || this == "") return false;
	return true;
}
