Or you can just trim off the end spaces.
Code:
int str_rtrim(STRING* input)
{	int trunc, pos;	for(pos=str_len(input)-1; pos>0; pos--)
	{	if((input.chars)[pos]!=32)
		{	str_trunc(input, (trunc=str_len(input)-pos-1));
			break;
	}	}
	return(trunc);
}

This function trims off any trailing spaces (on the right-hand end of the string),
and it returns the number of trimmed spaces if you want to know...



Last edited by EvilSOB; 04/01/10 21:21. Reason: clarified variable names

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial