StringIndexOutOfBoundsException

edgar_ortiz

Active Member
Licensed User
Longtime User
Hi,

I'm trying to generate multiple strings from a string and fails when execute the substring.

Ofcourse the values ​​are within range.

Any help is appreciate.

Is this a bug?

regards,

Edgar
 

Attachments

  • Test_WebService.zip
    4 KB · Views: 285
  • log.txt
    6.6 KB · Views: 305

specci48

Well-Known Member
Licensed User
Longtime User
SubString2 uses two parameters, BeginIndex and EndIndex. EndIndex should not be smaller than BeginIndex but if I look at your posted debug information, the values are
BeginIndex = loFirstByte = 46
EndIndex = loNumBytes = 44

I haven't looked closer to your project but I think line 202 should be corrected to
B4X:
lcData = lcWorkData.SubString2(lcFirstByte, lcLastByte)
or
B4X:
lcData = lcWorkData.SubString2(lcFirstByte, lcLastByte + 1)
to include the last byte.


specci48
 
Upvote 0

edgar_ortiz

Active Member
Licensed User
Longtime User
THANK YOU VERY MUCH :wav:

SubString2 uses two parameters, BeginIndex and EndIndex. EndIndex should not be smaller than BeginIndex

specci48



I did not see :BangHead:
I checked mote than 10 times and I did not see :BangHead:


Best Regards

Edgar
 
Upvote 0
Top