Re: [CODE]

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 07/18/00


James wrote:
>
> Well, since you want it so optimised ... :P
>
> void upper ( char *string ) {
>   int i=strlen(string)-1;
>   for (; i<0; CAP(string+(--i)));
> }

This stil uses strlen, at least it only uses it once, though.

>
>  .. or ..
>
> void upper(char *buf)
> {
>   for (; *buf; *buf = UPPER(*(++buf)));
> }

This will not capitalize the first letter and it will attempt to
capitalize the terminating NULL, try buf++ instead of ++buf.

Regards, Peter


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT