/** 
 * String processing utilities - not basic enough to add to String.prototype object
 * @author Rebecca Younes
 */

ILR.namespace("util");

ILR.util.string = {
	
	/**
	 * @description Append a final period + space to a string if it is not empty
	 * @param {String} str The string to append to
	 * @return {String}
	 */ 
	appendPeriodSpace : function(str) {
		if (str.length > 0) {
			str += ".";
		}
		return str;
	},

	/**
	 * @description Append a final space to a string if it is not empty
	 * @param {String} str The string to append to
	 * @return {String}
	 */
	appendSpace : function(str) {
		if (str.length > 0) {
			str += " ";
		}
		return str;
	},

	/**
	 * @description Append a final comma + space to a string if it is not empty
	 * @param {String} str The string to append to
	 * @return {String}
	 */
	appendCommaSpace : function(str) {
		if (str.length > 0) {
			str += ", ";
		}
		return str;
	},
	
	/** 
	 * @description Return true iff the argument is a string
	 * @param {Object} s
	 * @return {boolean}
	 */
	isString : function (s) {
		return typeof s == 'string';
	}

};
