Repository navigation
add the is_numeric method - #50
Open
useroutofbound wants to merge 3 commits into
Open
useroutofbound wants to merge 3 commits into
useroutofbound wants to merge 3 commits into
Conversation
Author
|
I have fixed the build issues by adding the override specifiers to the |
useroutofbound
commented
Sep 24, 2026
useroutofbound
left a comment
Author
There was a problem hiding this comment.
I have fixed the build issues by adding the override specifiers to the
is_numeric declarations in all derived classes within src/TinyJSON.h.
Owner
|
Thanks for this PR, but you will need to add some tests as well please. Especially for the |
Author
|
Added new test file and also fixed the unused parameter warning |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
is_numeric()toTJValueCloses #49
Summary
Adds a virtual
is_numeric(bool strict = false) constmethod toTJValueso any JSON value can report whether it is numeric. In non-strict mode, strings containing a valid number also count as numeric.Changes
src/TinyJSON.hvirtual bool is_numeric(bool strict = false) const;toTJValue.src/TinyJSON.cppTJValue(base)falseTJValueNumbertrueTJValueStringfalseifstrict; otherwise scans characters to validate a number (optional sign, decimal point, scientific notation)TJValueObject,TJValueArray,TJValueBoolean,TJValueNull,TJValueCommentfalseBehavior
strict = falsestrict = true42truetrue"42"truefalse"-3.14e2"truefalse"abc"falsefalse""falsefalsefalsefalseNotes
strictdefaults tofalseand the method is purely additive.TJValueNumberinstances.