But what I wrote, does not work as I need. I'm novice in Lua.
strnum=string.find(queryString,"%d+")
SetPower=tonumber(string.sub(queryString,strnum))
what do I need:
"assd45sdsf12dasf45" > "45"
"wfj85694sgsd" > "856"
"welfg1a2485ab546" > "1"
Thanks
Explore... Chat... Share...
strnum=string.find(queryString,"%d+")
SetPower=tonumber(string.sub(queryString,strnum))
pattern="[0-9][0-9]?[0-9]?"
function test(str)
print(str .. ":")
print(string.match(str,pattern))
end
test("assd45sdsf12dasf45")
test("wfj85694sgsd")
test("welfg1a2485ab546")
test("nodigit")
test("000atstart")
test("atend9876")
test("atend9")
assd45sdsf12dasf45:
45
wfj85694sgsd:
856
welfg1a2485ab546:
1
nodigit:
nil
000atstart:
000
atend9876:
987
atend9:
9
It takes about 20-25 seconds for home assistant c[…]
I tried to upgrade tof my sonoff basic R2 with the[…]
a problem Perhaps you want to define "Probl[…]
Rebooting your router will not give you a faster I[…]
There are no other notifications from esptool.py i[…]
Using the Arduino IDE, you'll learn how to set up […]
In this project, you will post to Twitter using an[…]
In this project, we will build a water level contr[…]
I guess I'm late, but I had the same problem and f[…]
Last night I received my first D1 Minis for a lear[…]
Although I am aware that this is an old post, I fe[…]