in reply to Validation of UserInput is a positive Integer or not?
"...Input is a positive Integer or not"
Try this:
#!/usr/bin/env perl use strict; use warnings; use Inline Java => q(./Karl.java); use feature qw(say); say Karl->isaInt($_) for ( -10, 0, 10 ); __END__ karls-mac-mini:inline karl$ ./run.pl -1 0 1
Karl.java:
import java.lang.Integer; class Karl { private Karl(){ } public static int isaInt( int n){ return Integer.signum(n); } }
It seems like it works ;-)
I guess that they burn me for this.
Please see also Inline.
Regards, Karl
«The Crux of the Biscuit is the Apostrophe»
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Validation of UserInput is a positive Integer or not?
by Lotus1 (Vicar) on Dec 08, 2015 at 21:30 UTC | |
by karlgoethebier (Abbot) on Dec 09, 2015 at 10:48 UTC |