I am going to get the output from a process with a 'open "! command"'.
What is the best way to check it returns exactly one line that
contains nothing else as one integer (beside white-space)?
Am 01.01.22 um 04:26 schrieb Cecil Westerhof:
I am going to get the output from a process with a 'open "! command"'.
What is the best way to check it returns exactly one line that
contains nothing else as one integer (beside white-space)?
string is integer $result
Christian Gollwitzer <auriocus@gmx.de> writes:
Am 01.01.22 um 04:26 schrieb Cecil Westerhof:
I am going to get the output from a process with a 'open "! command"'.
What is the best way to check it returns exactly one line that
contains nothing else as one integer (beside white-space)?
string is integer $result
It is so very simple. ;-)
This does accept the case where there is one or more empty lines (with white-space), but that is in my case not a problem.
Alan Grunwald <nospam.nurdglaw@gmail.com> writes:
On 01/01/2022 12:57, Cecil Westerhof wrote:
Christian Gollwitzer <auriocus@gmx.de> writes:string is -strict integer $result
Am 01.01.22 um 04:26 schrieb Cecil Westerhof:It is so very simple. ;-)
I am going to get the output from a process with a 'open "! command"'. >>>>> What is the best way to check it returns exactly one line that
contains nothing else as one integer (beside white-space)?
string is integer $result
This does accept the case where there is one or more empty lines (with
white-space), but that is in my case not a problem.
Nope:
$ puts ${result}
1234
$ string is integer -strict ${result}
1
On 01/01/2022 12:57, Cecil Westerhof wrote:
Christian Gollwitzer <auriocus@gmx.de> writes:string is -strict integer $result
Am 01.01.22 um 04:26 schrieb Cecil Westerhof:It is so very simple. ;-)
I am going to get the output from a process with a 'open "! command"'. >>>> What is the best way to check it returns exactly one line that
contains nothing else as one integer (beside white-space)?
string is integer $result
This does accept the case where there is one or more empty lines (with
white-space), but that is in my case not a problem.
Am 02.01.22 um 14:28 schrieb Cecil Westerhof:
Alan Grunwald <nospam.nurdglaw@gmail.com> writes:
On 01/01/2022 12:57, Cecil Westerhof wrote:Nope:
Christian Gollwitzer <auriocus@gmx.de> writes:string is -strict integer $result
Am 01.01.22 um 04:26 schrieb Cecil Westerhof:It is so very simple. ;-)
I am going to get the output from a process with a 'open "! command"'. >>>>>> What is the best way to check it returns exactly one line that
contains nothing else as one integer (beside white-space)?
string is integer $result
This does accept the case where there is one or more empty lines (with >>>> white-space), but that is in my case not a problem.
$ puts ${result}
1234
$ string is integer -strict ${result}
1
The difference is:
(demo) 58 % string is integer -strict ""
0
(demo) 59 % string is integer ""
1
Aah, thanks. So I should always use strict and when I want to be sure
there is only one line I should us split and llength.
On Sunday, January 2, 2022 at 3:44:19 PM UTC+1, Cecil Westerhof wrote:
Aah, thanks. So I should always use strict and when I want to be sure
there is only one line I should us split and llength.
regexp {^\d+$}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 73:02:10 |
Calls: | 6,657 |
Calls today: | 3 |
Files: | 12,203 |
Messages: | 5,332,382 |
Posted today: | 1 |