Skip to content

Instantly share code, notes, and snippets.

@foxiepaws
Last active December 14, 2015 18:09
Show Gist options
  • Save foxiepaws/5126898 to your computer and use it in GitHub Desktop.
Save foxiepaws/5126898 to your computer and use it in GitHub Desktop.
-- basic conversion of lowercase to caps using xor, port of logic from bleh.asm.
-- aka msify because microsoft LOVES caps.
import Data.Bits
import Data.Int
import Data.Char
import Control.Monad
caps :: Char -> Char
caps x =
if x >= 'a' && x <= 'z' then
chr(ord(x) `xor` 32)
else
x
bleh :: [Char] -> [Char]
bleh x = map caps x
main :: IO()
main = do
when (True) $ do
tstring <- getLine
putStrLn (bleh tstring)
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment