This project is read-only.

Converting String to Int

Dec 24, 2010 at 9:14 PM

How do you convert a string to int. I want to do calculations on the numbers that are in the string like add or subtract.

Dec 27, 2010 at 7:14 PM

plz help

Dec 29, 2010 at 10:13 AM

string a = "123";

for(int b = 0; b < 1000; b++) // the < 1000 is just so it eventually stops if the string isnt a number or is like "0123"

{

if(b.toString() == a)

{

break;

}

}

// b now equals 1000 or a

Dec 29, 2010 at 10:25 AM
please keep in mind that this will drain available memory, ie using that way of "parsing" an integer repeatedly will quickly crash the kernel...


On Wed, Dec 29, 2010 at 11:13 AM, xdalutzx <notifications@codeplex.com> wrote:

From: xdalutzx

string a = "123";

for(int b = 0; b < 1000; b++) // the < 1000 is just so it eventually stops if the string isnt a number or is like "0123"

{

if(b.toString() == a)

{

break;

}

}

// b now equals 1000 or a

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 29, 2010 at 2:15 PM

The code only works for one number that is 123.  I would have to make a string for every possible 32 bit number . The method above is going to slow down my OS.

 

Dec 29, 2010 at 3:25 PM
Please try to use Int32.Parse

On Wed, Dec 29, 2010 at 3:15 PM, forest201 <notifications@codeplex.com> wrote:

From: forest201

The code only works for one number that is 123. I would have to make a string for every possible 32 bit number . The method above is going to slow down my OS.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 30, 2010 at 4:33 PM

Int32.Parse doesn't work. it produces this Error:

C:\Dev\Cosmos User Kit\Tools\asm\main.asm : 104446 : error : symbol

`System_UInt32_Cosmos_ILCPU_RuntimeEngine_Heap_AllocNewObject_System_UInt32_' undefined

C:\Dev\Cosmos User Kit\Tools\asm\main.asm : 104447 : error : invalid combination of opcodes and operands

C:\Dev\Cosmos User Kit\Tools\asm\main.asm : 316837 : error : phase error detected at the end of assemply

 

Dec 30, 2010 at 5:14 PM
What userkit version are you using?


On Thu, Dec 30, 2010 at 5:33 PM, forest201 <notifications@codeplex.com> wrote:

From: forest201

Int32.Parse doesn't work. it produces this Error:

C:\Dev\Cosmos User Kit\Tools\asm\main.asm : 104446 : error : symbol

`System_UInt32_Cosmos_ILCPU_RuntimeEngine_Heap_AllocNewObject_System_UInt32_' undefined

C:\Dev\Cosmos User Kit\Tools\asm\main.asm : 104447 : error : invalid combination of opcodes and operands

C:\Dev\Cosmos User Kit\Tools\asm\main.asm : 316837 : error : phase error detected at the end of assemply

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 30, 2010 at 8:39 PM

Milestone 4

Dec 30, 2010 at 9:05 PM

u  wouldnt have to create a string for each number althougt that would be easy enough the code will would nomatter what the string is, whether its user imput or a constant.

stirng a = 1; would work

string a = console. readline();

all would work

i dont thnk it drains memery but it can take a while to run depending on how high the numbers ur dealing with r

Dec 30, 2010 at 9:14 PM

But still to for performance of my os i leave that part out.  

Dec 31, 2010 at 8:14 AM
Your best bet is update to latest release.

On Thu, Dec 30, 2010 at 10:14 PM, forest201 <notifications@codeplex.com> wrote:

From: forest201

But still to for performance of my os i leave that part out.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Dec 31, 2010 at 4:53 PM

I'll stick with milestone 4 because milestone 5 doesn't have VGAScreen and Mouse Driver. I have already done a full GUI in Milestone 4  and I am even putting the finishing touches on a floppy driver. So upgrading to milestone 5 is not an option. I will upgrade to a next Milestone when it has a VGA and Mouse Driver.

Dec 31, 2010 at 5:09 PM
MS5 isn't latest. but mouse and vga not implemented in latest.

On Fri, Dec 31, 2010 at 5:53 PM, forest201 <notifications@codeplex.com> wrote:

From: forest201

I'll stick with milestone 4 because milestone 5 doesn't have VGAScreen and Mouse Driver. I have already done a full GUI in Milestone 4 and I am even putting the finishing touches on a floppy driver. So upgrading to milestone 5 is not an option. I will upgrade to a next Milestone when it has a VGA and Mouse Driver.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com