ArduinoCore-API icon indicating copy to clipboard operation
ArduinoCore-API copied to clipboard

String object, len is of type unsigned int, however indexOf() and lastIndexOf() return int

Open artofit opened this issue 1 year ago • 0 comments

Description

String Object:

len is of type unsigned int. method that apply to position into the String or its size are expecting an unsigned int, this is the case with: charAt() substring() remove() reserve()

Oddly, indexOf() and lastIndexOf() are returning int and not unsigned int

Current behavior

Oddly, indexOf() and lastIndexOf() are returning int and not unsigned int

Expected behavior

indexOf() and lastIndexOf() ought to return unsigned int, to avoid unnecessary casting from int to unsigned int

Additional information

It's frequent to pass the result of indexOf() to substring()

Thanks

artofit avatar Oct 24 '24 18:10 artofit