Bug? - Alphabetical character "E" to integer

Conversion from letters to integers produces Null-values, as one would expect - except for the letter E, which is translated to 3. In my logic, the letter E should also produce Null values.

Scientific notation using the letter E works correctly, as far as I know.
image

I’m pretty sure that’s the mathematical constant e (i.e. being rounded/cast to an integer):

2021-05-14 10_55_54-Grasshopper - unnamed

2 Likes

Ok, this explains the behaviour… It is interpreted as Euler’s number.

image

Yep, I reached to the same conclusion.
I have to construct a more robust method for identifying alphabetical characters in alphanumerical codes then…

1 Like

The Python string class has several methods for identifying what the string represents (e.g. isalpha, isnumeric, and isAlnum) that might be handy here. Regular expressions are also great for these types of problems. You can implement the standard re Python module for this.

1 Like

I opted for isalpha. Small, clean and simple.

3 Likes

Love it :snake: