[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to check if a field is a number (integer or float)?
From: |
arnold |
Subject: |
Re: How to check if a field is a number (integer or float)? |
Date: |
Sun, 20 Jun 2021 08:08:30 -0600 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Peng Yu <pengyu.ut@gmail.com> wrote:
> > This is exactly correct. As you have been told many times: Read The Manual
> > and then you will no longer need to ask questions here. This will save
> > time for you, me and everyone else on this list.
>
> That is not correct. Reading the manual is not sufficient to ensure a
> solution is 100% correct. There can be always corner cases that only
> somebody who is familiar with the awk internal can be sure about.
> Otherwise, there wouldn't be so many partially correct solutions
> floating no the web.
You're a big boy. Read the manual, try stuff out on your own, and
figure out how things work. And/or read the code yourself.
> >> The best solution that I figured out is just `typeof(x) == "strnum"`||
> >> typeof(x) == "number"` instead of using regex.
> >
> > That should work.
>
> See, if this is disagreed by the next reply.
If you mean Andy's note, there's no contradiction in what he wrote
and in the test for strnum or number.
Re: How to check if a field is a number (integer or float)?, Peng Yu, 2021/06/19