maybeton =: 0&".^:('0'&-: +. 0 -.@-: 0&".) 0&".^:('0'&-: +. 0 -.@-: 0&".)
maybeton '3 22r4' 3 11r2 maybeton '3e2 22r4 two' NB. asking too much 300 5.5 0 maybeton 'two2' two2 On Saturday, September 10, 2022 at 02:49:30 p.m. EDT, Pawel Jakubas <jakubas.pa...@gmail.com> wrote: Dear J users, What is the way to detect number that could be represented as integer, float, could be negative, could assume scientific notation or rational. Is there something like isNumber or isString ? I would like to have something like this: if. (detect_number i) do. process number else. process string and detect_number to survive inputs i=: 2 i=: _2 i=: 2r3 i=: 2.3333 i=: 4.29497e9 i=: 'Two' Thanks and cheers, Pawel ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm