Check if string is numeric (no sign)
Java
Easy
8 views
Problem Description
Task: return true if all characters are digits and length > 0.
Output Format
Return value
Constraints
No spaces allowed.
Official Solution
static boolean isNumeric(char[] s){if(s.length==0) return false;for(char c:s) if(c<'0'||c>'9') return false;return true;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!