Created
April 26, 2018 07:12
-
-
Save akash0x53/d9a2fbc692f1054adc077b4b21bee1b8 to your computer and use it in GitHub Desktop.
String to Zero-width-string
This file contains hidden or 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
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