// append NewLine to every char in string

setinletassist(0,"insert carriage returns between each character of a string");
setoutletassist(0,"returned string, ready for umenu");

var str = new Array();
var i = 0;


function insertcr(str)
{
	i = 0;

	// post ("length = " + str.length + '; i = ' + i +  '\n');
	insertcr.str = (str[0] + '\n'); 
	// must supply an initial value or else undefined
		
	while (i < str.length) 
	{
		if (str[i] != " ")
		{
		// do nothing if there is an extra empty space	
			outlet(0, str[i] + '\n');
			// post(i + " " + str[i] + '\n');
			i++;
		}
		else if (str[i] == " ")
		{	i++; }
		else if (str[i] == "\n")
		{	i++; }
	}
	//outlet(0, insertcr.str); 
	// we don't need the whole string - just one at a time in the loop above
}