Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to first and second character for large numbers as string #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/WebHelpers.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,16 @@ Private Function json_StringIsLargeNumber(json_String As Variant) As Boolean

json_StringIsLargeNumber = True

' In the fisrt char is 0 the second must be . to be a large number
' otherwise it's a string
Dim first_Char, second_Char As Integer
first_Char = VBA.Asc(VBA.Mid$(json_String, 1, 1))
second_Char = VBA.Asc(VBA.Mid$(json_String, 2, 1))
If first_Char = 48 And second_Char <> 46 Then
json_StringIsLargeNumber = False
Exit Function
End If

For json_CharIndex = 1 To json_Length
json_CharCode = VBA.Asc(VBA.Mid$(json_String, json_CharIndex, 1))
Select Case json_CharCode
Expand Down