views:

37

answers:

2

Do Integer data types allow spaces when it should be just numeric?

Do other programming languages allow spaces in an Integer data type?

For example, MySQL database storage does not allow spaces to be stored in an int data type. Do other languages allow it when storing in their own int type?

A: 

Not any sane one. However, some languages (e.g. Python) and databases (e.g. SQLite) are strongly typed on the value, not variable or column. So while an integer can never hold spaces (or indeed any string), the same variable or column may hold elements of more than one type. See the SQLite FAQ.

Matthew Flaschen
+2  A: 

Don't let the fact that some systems present integers to the user, or accept integers from the user, with spaces or commas or other formatting fool you into thinking that integers can contain spaces or commas or anything else.

Integers are numbers and you are best thinking of them as just that, no more and no less.

High Performance Mark
+1 for not mixing the value and it's representation
Col. Shrapnel