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.indexOf returns -1(!) if not found #7

Open
UlliBien opened this issue Apr 10, 2017 · 1 comment
Open

String.indexOf returns -1(!) if not found #7

UlliBien opened this issue Apr 10, 2017 · 1 comment

Comments

@UlliBien
Copy link

  1. You use "if(request.indexOf('M-SEARCH') > 0) ..." this is false if 'M-SEARCH' is at the beginning of a string.
    Use "if(request.indexOf('M-SEARCH') > -1)" instead.
    There are other occurrences of this.

  2. indexOf('M-SEARCH') only looks for 'M' and not for 'M-SEARCH'. Use "M-SEARCH" instead (with double quotes).

@witnessmenow
Copy link
Owner

Thanks for letting me know. I am crazy busy for the next few weeks and will only be able to get to it then. Would you be able submit a PR before that?

kakopappa added a commit to kakopappa/arduino-esp8266-alexa-wemo-switch that referenced this issue Dec 19, 2017
'M-SEARCH' changed to "M-SEARCH"

indexOf('M-SEARCH') only looks for 'M' and not for 'M-SEARCH'. Use "M-SEARCH" instead (with double quotes).

witnessmenow/esp8266-alexa-wemo-emulator#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants