[Jprogramming] A Complaint with Format

Peter B. Kessler Peter.B.Kessler at Oracle.COM
Sat Sep 24 01:01:11 UTC 2016


Have the input be your verb, a 1, and the 2-5 digit number.  E.g., instead of entering 012, the user enters 1012.  Then you can strip off the leading 1 after you have converted the input to a string.

Some users will forget, and there's no way to know if a leading 1 should have been entered as 11.  Maybe apply Benford's Law and use 9 to preserve any leading 0s.  Maybe none of your data uses an initial 9, as in the examples you give, so typos could be detected.

			... peter

On 09/23/16 01:12 PM, Skip Cave wrote:
> I have a verb that users can enter, followed by a 2-5 digit number that the
> user enters.
>
>
> The input is typed in as a verb followed by a number, but the number can
> have leading zeros
>
>
>    ": 123
>
> 123
>
>    #": 123
>
> 3                 NB. What I would expect
>
>    ": 1305610
>
> 1305610
>
>    #": 1305610
>
> 7                 NB. Also expected
>
>
>    ":012
>
> 12
>
>    #":012
>
> 2                 NB. 😠  Not what I expected.
>
>
>    ":000345
>
> 345
>
>    #":000345
>
> 3
>
>
>    ":00034500
>
> 34500
>
> #":00034500
>
> 5
>
>
>
> NB. 😵 It drops leading zeros instead of just converting them to text!
>
>
> It doesn't drop internal zeros or trailing zeros, just leading zeros and
> only zeros. Not very consistent.
>
>
> I need to have the numeric input typed after a verb be converted to a
> character string that is an exact copy of the input number. I could require
> that the input be quoted, but would prefer to not have require that.
>
>
> Skip
>
>
>
>
>
>
> Skip Cave
> Cave Consulting LLC
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


More information about the Programming mailing list