Hi On 8/26/25 16:48, Larry Garfield wrote:
I have multiple times just recently had need of "I have a numeric string, should I cast it to an int or a float?", for which an is_representable_as_int() function (or similar) would be quite helpful, and neater than the messy solution I usually use.
It would've been nice to know what that use-case is, rather than just knowing that you had that use-case.
I'm having a hard time thinking of something where I don't a-priori know what type I expect to get and would need to inspect the value to make a decision.
I see how having a function that safely coerces a string into an int, returning null if coercion fails, basically intval() with better error handling and taking only `string`s, could be useful, but that's not what is being asked here.
Best regards Tim Düsterhus