Skip to content

Instantly share code, notes, and snippets.

@akash0x53
Created April 26, 2018 07:12
Show Gist options
  • Save akash0x53/d9a2fbc692f1054adc077b4b21bee1b8 to your computer and use it in GitHub Desktop.
Save akash0x53/d9a2fbc692f1054adc077b4b21bee1b8 to your computer and use it in GitHub Desktop.
String to Zero-width-string
char_map = {'1': u'\u200C', '0': u'\u200B'}
def str_to_zwstr(inp):
bininp = ''.join(map(lambda x:bin(x).lstrip('0b'), map(ord, inp)))
return ''.join(map(lambda x:char_map[x], bininp))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment