Skip to main content
10 events
when toggle format what by license comment
Feb 8, 2023 at 15:10 history edited Jerry Coffin CC BY-SA 4.0
corrected UB in use of cctype functions
Feb 8, 2023 at 7:46 comment added Jerry Coffin @chux-ReinstateMonica: I've updated the code with a fix for that bug and a minor simplification.
Feb 8, 2023 at 7:44 history edited Jerry Coffin CC BY-SA 4.0
Code correction and simplification
Feb 8, 2023 at 3:07 comment added Jerry Coffin @chux-ReinstateMonica: Ah, good catches. Thank you.
Feb 8, 2023 at 2:55 comment added chux Code accepts "0.1e-".
Feb 8, 2023 at 2:52 comment added chux Curious to use isdigit(), then std::isdigit().
Aug 6, 2022 at 1:25 comment added Jerry Coffin @SogaBan: Ignoring commas should be pretty easy--pretty much while (isdigit(ch)) becomes while (isdigit(ch) || ch == ','). There is a bit of trickiness, as that will let something like ,9 through, where you probably only want to allow a comma that's both preceded and followed by a digit.
Aug 5, 2022 at 23:07 comment added SogaBan I also wanted to add provisions for separator. For example, -3,4,89,000.7789 will be considered a valid input; while -3,56,000.98,9876 will be not. Using your code base, I got an error on this one: Test Failed for: -4,34,678 And salute to your so lucid and simple algorithm!! Will I ever reach that place? I wonder...
Aug 5, 2022 at 19:20 history edited Jerry Coffin CC BY-SA 4.0
added 1529 characters in body
Aug 5, 2022 at 19:05 history answered Jerry Coffin CC BY-SA 4.0