Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Numeric

Numeric

Scheduled Pinned Locked Moved C#
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    quocbao
    wrote on last edited by
    #1

    :sigh: I do not know if the string enter is number.

    C B 2 Replies Last reply
    0
    • Q quocbao

      :sigh: I do not know if the string enter is number.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Here is one possible test implementation, but of course exceptions should not really be used like this (it is bad because an exception takes so much time to handle).

      try
      {
      Convert.ToInt32(myString);
      }
      catch
      {
      // myString is not a valid number
      }


      "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar "On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871)

      1 Reply Last reply
      0
      • Q quocbao

        :sigh: I do not know if the string enter is number.

        B Offline
        B Offline
        bertcox
        wrote on last edited by
        #3

        What do you mean?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups