/*
function ucfirst(value) {
	var reg = new RegExp('([^a-z]*)([a-z])([a-z]*)', 'gi');
	var output = '';
	
	while (matches = reg.exec(value)) {
		output += matches[1] + matches[2].toUpperCase() + matches[3];
	}
	
	return output;
}
/**/


//change a word to make it plural: ie: car -> cars, fly -> flies
function plural(value) {
	value = String(value);
	var len = value.length;
	var start = value.substr(0, len-1);
	var end = value.substr(len-1, 1).toLowerCase();
	
	var output = '';
	switch (end) {
		case 'y':	output = start+'ies';	break;
		case 's':	output = value;			break;
		default:	output = value + 's';	break;
	}
	
	return output;
}



//pad string with value
function str_pad(value, length, padString, padType) {
	value = String(value);
	if (padType == true) {
		while (value.length < length) {
			value = padString + value;
		}
	} else {
		while (value.length < length) {
			value += padString;
		}
	}
	value = String(value).substr(0, length);/**/
	return value;
}





//returns string up until value, ie: trimLast('testing', 'i') = 'test'
function trimLast(source, value) {
	var pos = source.toLowerCase().lastIndexOf(value.toLowerCase());
	if (pos > -1) {
		source = source.substr(0, pos);
	}
	return source;
}
//like trimLast, but returns the trimmed part
function strLast(source, value) {
	var pos = source.toLowerCase().lastIndexOf(value.toLowerCase());
	if (pos > -1) {
		source = source.substr(pos + value.length);
	}
	return source;
}



