[DGD] case conversion

Robert Forshaw iouswuoibev at hotmail.com
Tue Jan 6 22:39:53 CET 2004


My case conversion function doesn't work.

string lower_case(string str)
{
	string ch;
	int count, len;

	if(str == nil || str == "") return "";

	len = strlen(str);

	for(count = 0; count < len; ch[0] = str[count++])
	{
		if(ch[0] > 64 && ch[0] < 97) str[count] = ch[0] + 32;
	}

	return str;
}

I've observed (incorrectly?) that the only way to refer to a char rather 
than a string is to refer to an element of a string (all other drivers I've 
seen return a string with a single char). I'm assuming that you can also 
manipulate and compare a char as if it were an 8 bit integer, in order to 
modify its case. Are these assumptions correct? Incidently, the lower_case() 
function gets the following error:
"Index on bad type".

Any help would be appreciated.

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://www.msn.co.uk/messenger

_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list