File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ public String nextTo(char delimiter) throws JSONException {
396
396
public String nextTo (String delimiters ) throws JSONException {
397
397
char c ;
398
398
StringBuilder sb = new StringBuilder ();
399
- for (;; ) {
399
+ for (; ; ) {
400
400
c = this .next ();
401
401
if (delimiters .indexOf (c ) >= 0 || c == 0 ||
402
402
c == '\n' || c == '\r' ) {
@@ -457,9 +457,9 @@ private Object getValue(char c, boolean strictMode) {
457
457
if (strictMode ) {
458
458
Object valueToValidate = nextSimpleValue (c , true );
459
459
460
- boolean isNumeric = valueToValidate . toString (). chars (). allMatch ( Character :: isDigit );
460
+ boolean isNumeric = checkIfValueIsNumeric ( valueToValidate );
461
461
462
- if (isNumeric ){
462
+ if (isNumeric ) {
463
463
return valueToValidate ;
464
464
}
465
465
@@ -475,6 +475,15 @@ private Object getValue(char c, boolean strictMode) {
475
475
return nextSimpleValue (c );
476
476
}
477
477
478
+ private boolean checkIfValueIsNumeric (Object valueToValidate ) {
479
+ for (char c : valueToValidate .toString ().toCharArray ()) {
480
+ if (!Character .isDigit (c )) {
481
+ return false ;
482
+ }
483
+ }
484
+ return true ;
485
+ }
486
+
478
487
/**
479
488
* This method is used to get a JSONObject from the JSONTokener. The strictMode parameter controls the behavior of
480
489
* the method when parsing the JSONObject.
You can’t perform that action at this time.
0 commit comments