Loriel->
I still don't see why MudOS/LPC wouldn't support a basic data type found in so many other OOP related languages, I mean, assuming Lars Pensjo(sp) made that decision, why would he/or something opt to not use it?
Ogma->
[code]
string alt_caps( string str )
{
int i = strlen(str);
while( i-- )
switch( str[i] ){
case 65..90 ;
( i%2 ) ? str[i] = str[i]+32 ; str[i] = str[i];
break;
case 97..122 ;
( i%2 ) ? str[i] = str[i] ; str[i] = str[i]-32;
break;
}
return str;
}[/quote]
That's what I had come up with after KaVir put in his 2 cents, I realized he was writing in C, seeing as he developes with MUD's that are written in C it makes sense further. I apologize for not specifying it was in LPC. Despite that, his example was useful.
|