Four Char Code From String in Python


/ Published in: Python
Save to your folder(s)

Useful for SBApplication scripting bridge.


Copy this code and paste it in your HTML
  1. def makeNumberFromCharCode(code):
  2. return (ord(code[0]) << 24) | (ord(code[1]) << 16) | (ord(code[2]) << 8) | ord(code[3])
  3.  
  4. # In Carbon / Cocoa:
  5. # FourCharCode code = 'abcd'
  6. # In Python:
  7. # code = makeNumberFromCharCode("abcd")

URL: http://www.cocoadev.com/index.pl?FourCharCode

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.