while (*s++ = ((*t & 0x60) == 0x40 ? *t ^ 0x20 : *t)) t++;
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
It corrupts strings with @ [ \ ] ^ and _ in them.
Neil Hudson
-
Copying string, turning upper case into lower case...
-
Rob Philpott wrote:
Any takers for what this gem does?
Why that's obvious. It makes you hate the coder who spewed it into your source.
I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be
I was going to say "Hopefully get someone sacked". Maybe a bit harsh on my part.
-
It definitely returns a string with all lowercase characters.
Larry G. Grimes wrote:
It definitely returns a string with all lowercase characters.
It'll change other characters too, such as '@' to '`'!
-
Worked for ANSI to, albeit only the lower parts :rolleyes:
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
maybe the author should start writing normal code.. in c#, this would be done with s.ToLower() yeah.. thats it.. no non-sense pointer code with an inline loop referencing hex values
-
Worked for ANSI to, albeit only the lower parts :rolleyes:
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
Maybe something like this would work better, then we can use the code for email addresses etc.
while (*s++ = (*t >='A' && *t <= 'Z' ? *t ^ 0x20 : *t) ) t++;
-
..just for fun really. It's nearly the weekend..
Regards, Rob Philpott.
Robbo!
-
Robbo!
Dude!
Regards, Rob Philpott.
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
I will assume both
s
andt
arechar*
.*t & 0x60
: Filters all but two bits of*t
. I will call those bits xy (the most significant one first).(*t & 0x60) == 0x40
: Tests whether xy is 10.(*t & 0x60) == 0x40 ? *t ^0x20 : *t
: If xy is 10, it returns a new character equal to*t
, but with xy equal to 11. Otherwise, it returns the original character. The whole loop iterates through a C string starting ats
and copies it to another C string starting att
, but characters from 0x40 to 0x5F are converted into characters from 0x60 to 07F. The original string is left untouched, unlesss
equalst
. (Ift
points to another character actually inside the C string pointed bys
or vice versa, the program goes crazy.) To the end user, this means the following: Uppercase characters are converted into lowercase characters, square brackets are converted into braces, the backslash is converted into a vertical line character, the French circumflex accent character is converted into the tilde character, and the underline character is converted into a DEL character.If you can play The Dance of Eternity (Dream Theater), then we shall make a band.
-
It's turning into one of 'those' Friday afternoons. Any takers for what this gem does?
Regards, Rob Philpott.
This is trivial ToLover() ... well, if you know ASCII. This is better: while (*s++ = ((*t & ~0x1F) == 0x40 ? *t ^ 0x20 : *t)) t++; And this is more clear: #define mask (~('a'-'B')) while (*s++ = ((*t & mask == ('A' & mask) ? *t ^ ('a'-'A') : *t)) t++;
www.codigi.net .NET touch screen GUI components suite