I want to convert four character string text into 32bit integer number, e.g. four space string should return 0x20202020. All string elements are ASCII. I know that something like this works
number = ord(text[0]) << 24 | ord(text[1]) << 16 | ord(text[2]) << 8 | ord(text[3]) << 0
but it is rather slow and inefficient. Is there any faster way?
EDIT: This is meant to part of the algorithm sending a string to LCD display via C/Assembler script. String has to be split into list containing numbers that represent four characters each.
Regards.
id(text)might be an option, depending on your application