variable integer
Is there any command which checks whether a variable is an integer.
I don't want to write a function for this. Is there an inbuilt command that can verify if a variable is integer. |
|
For Java
You can try boolean isVarAnInt = false try { Integer temp = new Integer(variableName); if (temp.intValue() > 0 || temp.intValue() < 0 || temp.intValue() == 0) { System.out.println("Input Variable Is An Integer"); isVarAnInt = true; } } catch (NumberFormatException err) { System.out.println("Input Variable Is Not An Integer"); } I haven't compiled the above code. So, there might be some small syntax issues that you might need to fix using ur IDE. |
oh sorry. I am using korn shell.
A check something similar to Quote:
|
See this thread http://www.linuxquestions.org/questi...n-bash-279227/
In short, no, not like that. |
All times are GMT -5. The time now is 09:14 PM. |