-
-
Save TotallyMehis/13fc9215595ff342309024c628d7520e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
int main() | |
{ | |
auto badmatch = []( unsigned char cName, unsigned char cQuery ) { | |
if ( cName == cQuery ) | |
return true; | |
else if ( cName - 'A' <= (unsigned char)'Z' - 'A' && cName - 'A' + 'a' == cQuery ) | |
return true; | |
else if ( cName - 'a' <= (unsigned char)'z' - 'a' && cName - 'a' + 'A' == cQuery ) | |
return true; | |
return false; | |
}; | |
auto goodmatch = []( unsigned char cName, unsigned char cQuery ) { | |
if ( cName == cQuery ) | |
return true; | |
else if ( (unsigned char)(cName - 'A') <= 'Z' - 'A' && cName - 'A' + 'a' == cQuery ) | |
return true; | |
else if ( (unsigned char)(cName - 'a') <= 'z' - 'a' && cName - 'a' + 'A' == cQuery ) | |
return true; | |
return false; | |
}; | |
auto fastermatch = []( unsigned char cName, unsigned char cQuery ) { | |
if ( cName == cQuery ) | |
return true; | |
else if ( (cName | 32) == cQuery ) | |
return true; | |
else if ( (cQuery | 32) == cName ) | |
return true; | |
return false; | |
}; | |
// Loop through all characters. | |
for ( auto i = 32; i <= 126; i++ ) | |
{ | |
auto cQuery = (unsigned char)i; | |
for ( auto j = 32; j <= 126; j++ ) | |
{ | |
auto cName = (unsigned char)j; | |
if ( badmatch( cName, cQuery ) ) | |
//if ( goodmatch( cName, cQuery ) ) | |
//if ( fastermatch( cName, cQuery ) ) | |
{ | |
printf("%c=%c\n", cName, cQuery ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment