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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. string to int in C#?

string to int in C#?

Scheduled Pinned Locked Moved C#
questioncsharp
4 Posts 4 Posters 1 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.
  • L Offline
    L Offline
    Lilli Alexis
    wrote on last edited by
    #1

    What is a quick way to cast a string (consisting of a number) into an int variable? Isn't there some quick function build in somewhere?

    X L L 3 Replies Last reply
    0
    • L Lilli Alexis

      What is a quick way to cast a string (consisting of a number) into an int variable? Isn't there some quick function build in somewhere?

      X Offline
      X Offline
      XRaheemX
      wrote on last edited by
      #2

      Convert.ToInt32(string); also Convert.ToInt16(string); I would look at all of the methods that the Convert class provides, they will all come in handy :)

      1 Reply Last reply
      0
      • L Lilli Alexis

        What is a quick way to cast a string (consisting of a number) into an int variable? Isn't there some quick function build in somewhere?

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        int.Parse() xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

        1 Reply Last reply
        0
        • L Lilli Alexis

          What is a quick way to cast a string (consisting of a number) into an int variable? Isn't there some quick function build in somewhere?

          L Offline
          L Offline
          leejo123
          wrote on last edited by
          #4

          i think this should help string s="3"; int i = Convert.ToInt32(s); Leejo

          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