1
18k11tm001
I am reading an ASCII data file and converting some of the strings to
integers or floats. However, some of the data is corrupted and the
conversion doesn't work. I know that I can us exceptions, but they
don't seem like the cleanest and simplest solution to me. I would like
to simply perform a pre-check before I do the conversion, but I can't
figure out how to do it. I see that strings have a function called
isdigit(), but that simply checks whether all characters in the string
are digits -- not what I need. Any suggestions? Thanks.
integers or floats. However, some of the data is corrupted and the
conversion doesn't work. I know that I can us exceptions, but they
don't seem like the cleanest and simplest solution to me. I would like
to simply perform a pre-check before I do the conversion, but I can't
figure out how to do it. I see that strings have a function called
isdigit(), but that simply checks whether all characters in the string
are digits -- not what I need. Any suggestions? Thanks.