Hacker News new | past | comments | ask | show | jobs | submit login

I do sometimes go back and stare at this wonder I crafted once:

  s=>s[0]+/.*( .|z)|...s.s?|T..|M[i-t]+|[AFINOUW][^o]v?|.*/.exec(s)[0].slice(-1).toUpperCase()
It does something pretty useful, that has surely been written many times over. But unlikely ever as succinctly as this. :)



Alright, I'll bite - what does it do?



It takes the name of a state in the United States and returns its two letter abbreviation.

EDIT: I swear I didn't look at the CodeGolf link. :(




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: