Right now you need to write your own functions but your request in nice.
Give me few days (I've something urgent to finish for the next two days) and I will add one or two native functions for reading numbers.
In my console program I'm writing I need a way to get a number from the user. It needs to accept only digits (numbers from 0-100). Right now I'm using console_readline and I need a way to keep the user from typing in letters.
Is there something built in to thinbasic that will do this or do I need to write a function?
Thanks
Right now you need to write your own functions but your request in nice.
Give me few days (I've something urgent to finish for the next two days) and I will add one or two native functions for reading numbers.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Wow, input function with validation for specific entries would be neat. They could even be just separate commands to make it easy to make and use.
input:
only numbers: 0 1 2 3 4 5 6 7 8 9
only numbers and separators: 0 1 2 3 4 5 6 7 8 9 , .
money: $ 0 1 2 3 4 5 6 7 8 9 , . the dollar sign could be also for Euro and other currency symbols
input only phone numbers (012) 345-6789
Well you get the idea. Good recommendation Sandy, Eros will make something awesome when he has the time you can count on that!!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
To start, you can already use VERIFY function to test if input string contains only the chars you want.
VERIFY returns zero if each character in MainString is present in MatchString. If not, it returns the position of the first non-matching character in MainString.
[code=thinbasic]
DIM lPos AS LONG
'---returns 4 since "." is not in "0123456789"
lPos = VERIFY("123.65,22.5", "0123456789")
[/code]
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Wow, that is perfect then. Very flexible way to handle it!!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Bookmarks