- Where Developers Learn, Share, & Build Careers
I have a method that accepts string logic.
An integer in the string, double, boolean, or just plain old letters and numbers.
I want an easy way to determine what type of string is.
There is a way to catch a bunch of blocks and try to parse it in every type, and if an exception is thrown, then it is probably not that data type. It seems incorrect because it is an intuitive program, not a deterministic program.
If you know how to once you enter the parameter You know, it is ok to parse that type of string and catch the exception - it's fair use of exceptions to capture invalid data (unless you're just trying one type ..)
Comments
Post a Comment