string bug or maybe its me - can't figure this out...
Posted: Thu Dec 31, 2015 6:24 pm
I am trying to write a small parser for my little www clock that will show the ip address of the clock once it joins the network. For the life of me, I cannot understand why this little slice of code is not working. The right string function seems to want to add a "." at the end of the result.
Here is a simplified piece of the code giving me fits, and then the result.
The result when run...
You can see that when I get the temp$, it has an extra dot at the end for some reason. I ask for the 8 rightmost characters in the ipstr$ and I get the extra dot and the length shows up as 9. What in tarnations am I not getting here? Can someone try this simple code and see if they get the same result?
I am using espbasic version 1.69
Thanks a million.
Edit...
I did a variable dump and the temp$ shows correctly without the dot at the end. Not sure why it shows up after the right string function but not in the variable dump. Of course this hoses the parser...
Here is a simplified piece of the code giving me fits, and then the result.
Code: Select all
ipstr$ = 192.168.1.12
serialprint "ipstr$ = "
serialprintln ipstr$
serialprintln ""
serialprint "length of ipstr$ = "
serialprintln len(ipstr$)
serialprintln ""
check = 8
temp$ = right(ipstr$,check)
serialprint "temp$ = "
serialprintln temp$
serialprintln ""
serialprint "length of temp$ = "
serialprintln len(temp$)
serialprintln ""
end
The result when run...
Code: Select all
ipstr$ = 192.168.1.12
length of ipstr$ = 12
temp$ = 168.1.12.
length of temp$ = 9
Done...
You can see that when I get the temp$, it has an extra dot at the end for some reason. I ask for the 8 rightmost characters in the ipstr$ and I get the extra dot and the length shows up as 9. What in tarnations am I not getting here? Can someone try this simple code and see if they get the same result?
I am using espbasic version 1.69
Thanks a million.
Edit...
I did a variable dump and the temp$ shows correctly without the dot at the end. Not sure why it shows up after the right string function but not in the variable dump. Of course this hoses the parser...