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

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

Open
artofit opened this issue Oct 24, 2024 · 0 comments
Labels

Comments

@artofit
Copy link

artofit commented Oct 24, 2024

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 artofit added the bug label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant