8 kyu

Is it a number?

2,990 of 16,663provector

Description:

Given a string s, write a method (function) that will return true if its a valid single integer or floating number or false if its not.

Valid examples, should return true:

isDigit("3")
isDigit("  3  ")
isDigit("-3.23")

should return false:

isDigit("3-4")
isDigit("  3   5")
isDigit("3 5")
isDigit("zero")
Fundamentals

More By Author:

Check out these other kata created by provector

Stats:

CreatedApr 16, 2016
PublishedApr 16, 2016
Warriors Trained33880
Total Skips2021
Total Code Submissions132380
Total Times Completed16663
Java Completions2990
Python Completions7063
JavaScript Completions5287
C# Completions1105
C++ Completions630
Scala Completions18
Total Stars349
% of votes with a positive feedback rating84% of 2134
Total "Very Satisfied" Votes1620
Total "Somewhat Satisfied" Votes358
Total "Not Satisfied" Votes156
Ad
Contributors
  • provector Avatar
  • jhoffner Avatar
  • SithFire Avatar
  • smile67 Avatar
  • PrivateShorty Avatar
  • hobovsky Avatar
  • aphex3k Avatar
  • SergeySinyavskiy Avatar
  • KayleighWasTaken Avatar
  • saudiGuy Avatar
Ad