Alan Grunwald <
nospam.nurdglaw@gmail.com> writes:
On 01/01/2022 12:57, Cecil Westerhof wrote:
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.
string is -strict integer $result
Nope:
$ puts ${result}
1234
$ string is integer -strict ${result}
1
But for my current situation it is certainly not a showstopper.
And when it becomes a showstopper I can use:
llength [split ${result} \n
and check it returns 1.
In case it will not be visible:
- the first line contains ' 1234 '
- the two lines beyond that contain ' '
--
Cecil Westerhof
Senior Software Engineer
LinkedIn:
http://www.linkedin.com/in/cecilwesterhof
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)