Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Convert a string to an integer


  • Please log in to reply
3 replies to this topic

#1 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 09 February 2013 - 11:48 PM

Hello guys,

 

in C# .NET you can convert a string containing a number into an integer with "Convert.ToInt32(string);", but in the .NET Micro Frameowrk 4.2 that doesen't work with the Netduino 1 Plus.

 

So - Is there any possibility to do this?

 

Many thanks in advance,

JoRu1407



#2 NooM

NooM

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationAustria

Posted 09 February 2013 - 11:50 PM

Int32 yourInt = Int32.Parse("122");

 

doesent work for single/double :(

 

edit: baxter is right, its working for double, but for Single i dont have parse



#3 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 10 February 2013 - 02:34 AM

This works for me in VB on a netduino Plus 1 with the latest software. It surely must work with C#.

 

Dim anInt As Integer = CInt("1234567")Debug.Print(anInt.ToString) --> 1234567anInt = Int32.Parse("1234567")Debug.Print(anInt.ToString) --> 1234567Dim aDouble As Double = Double.Parse("3.117775511E-03")Debug.Print(aDouble.ToString) --> 0.0031177755110000003

 

 



#4 JoRu1407

JoRu1407

    Advanced Member

  • Members
  • PipPipPip
  • 37 posts

Posted 10 February 2013 - 09:22 AM

Tanks for your quick answers.

I tried it with "Int32.Parse(string);" and it works great.

 

JoRu1407






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.