I will use parseFloat and parseInt in strutils 
[https://play.nim-lang.org/#ix=2bVE](https://play.nim-lang.org/#ix=2bVE)
    
    
    import strutils
    
    
    proc isNumberic*(value: string): bool =
      result = true
      try:
        discard parseInt(value)
      except ValueError:
        try:
          discard parseFloat(value)
        except ValueError:
          result = false
    
    assert isNumberic("-42.3")
    assert isNumberic("3")
    assert not isNumberic("zs")
    
    
    
    Run

Reply via email to