I have Stringone that can be in many different formats. I need to be able to recognize the actual type of a value in runtime, and then convert the value to that type.
For instance. If I have String Fri Feb 08 07:30:00 GMT 2013, it is in fact Date, but Stringshould be converted to date objectand returned as such.
My current solution to this problem is to "try" to convert it to a data type, if the conversion is successful, then all is well, if the conversion fails, go to the next conversion attempt. It works, but is ugly and insecure, and I am sure that a better solution already exists there.
Thank.
source
share