D Declan Well-Known Member Licensed User Longtime User May 28, 2018 #1 I receive the following string frm Sigfox Callback: Code: 00786d653fb7da0123000000 I then parse the required data from the string with: Code: Log("Got Sense01") Dim ProductType As String = cFrame.SubString2(0,2) Dim beaconmac As String = cFrame.SubString2(2,14) Dim messageStatus As String = cFrame.SubString2(14,2) Dim BattLevel As String = cFrame.SubString2(16,2) However, I receive the following error at line "Dim messageStatus As String = cFrame.SubString2(14,2)": Code: An error occurred: (Line: 122) Dim messageStatus As String = cFrame.SubString2( java.lang.StringIndexOutOfBoundsException: String index out of range: -12
I receive the following string frm Sigfox Callback: Code: 00786d653fb7da0123000000 I then parse the required data from the string with: Code: Log("Got Sense01") Dim ProductType As String = cFrame.SubString2(0,2) Dim beaconmac As String = cFrame.SubString2(2,14) Dim messageStatus As String = cFrame.SubString2(14,2) Dim BattLevel As String = cFrame.SubString2(16,2) However, I receive the following error at line "Dim messageStatus As String = cFrame.SubString2(14,2)": Code: An error occurred: (Line: 122) Dim messageStatus As String = cFrame.SubString2( java.lang.StringIndexOutOfBoundsException: String index out of range: -12
DonManfred Expert Licensed User Longtime User May 28, 2018 #2 SubString2 (BeginIndex As Int, EndIndex As Int) As String Returns a new string which is a substring of the original string. The new string will include the character at BeginIndex and will extend to the character at EndIndex, not including the last character. The second value is NOT A LENGTH! Upvote 0
SubString2 (BeginIndex As Int, EndIndex As Int) As String Returns a new string which is a substring of the original string. The new string will include the character at BeginIndex and will extend to the character at EndIndex, not including the last character. The second value is NOT A LENGTH!
D Declan Well-Known Member Licensed User Longtime User May 28, 2018 #3 DonManfred said: SubString2 (BeginIndex As Int, EndIndex As Int) As String Returns a new string which is a substring of the original string. The new string will include the character at BeginIndex and will extend to the character at EndIndex, not including the last character. The second value is NOT A LENGTH! Click to expand... @DonManfred - Many thanks I forgot that Upvote 0
DonManfred said: SubString2 (BeginIndex As Int, EndIndex As Int) As String Returns a new string which is a substring of the original string. The new string will include the character at BeginIndex and will extend to the character at EndIndex, not including the last character. The second value is NOT A LENGTH! Click to expand... @DonManfred - Many thanks I forgot that
DonManfred Expert Licensed User Longtime User May 28, 2018 #4 Declan said: Many thanks I forgot that Click to expand... The onlinehelp is showing you the info that the index is needed, not a length... Upvote 0
Declan said: Many thanks I forgot that Click to expand... The onlinehelp is showing you the info that the index is needed, not a length...
D Declan Well-Known Member Licensed User Longtime User May 28, 2018 #5 Thanks, I just overlooked that How do I covert: Code: Dim BattLevel As String = cFrame.SubString2(16,2) to the Decimal Value of the BattLevel String? Upvote 0
Thanks, I just overlooked that How do I covert: Code: Dim BattLevel As String = cFrame.SubString2(16,2) to the Decimal Value of the BattLevel String?
S sorex Expert Licensed User Longtime User May 28, 2018 #6 by using an int instead of string? Code: Dim BattLevel As Int = cFrame.SubString2(16,2) Upvote 0