G***G 发帖数: 16778 | 1 given a string, how to know its data type using c or c#?
for example, '5555', output is integar
'wwws4444' is string
'1111E-6' is long | s**m 发帖数: 1564 | 2 regular expression can help to a certain degree, however, it may not be a
final oasis if strings are very complicated.
but do you really have to do it this way? where are the data from and why do
they all come in as strings? | a****l 发帖数: 8211 | 3 there is no universal and fail-proof way. You have to have assumptions and
requirements, otherwise the possibilities is just endless.
E.g., tell me, what is "ABC555"? is it a string or hex number? If you can'
t figure it out with your brain, how can you assume the computer can?
【在 G***G 的大作中提到】 : given a string, how to know its data type using c or c#? : for example, '5555', output is integar : 'wwws4444' is string : '1111E-6' is long
|
|