2 more beginner questions

  • Thread starter Thread starter H
  • Start date Start date
H

H

Hi again !

I have 2 more questions, and I know theyre simple for you guys, so I hope
you can help me.

1. Is there a c++ like command like system ? For example in c++ you can use
system("cd dir1"). I know this wouldnt go so well along with compability on
all platforms, but maybe there is such a command anyway ?

2. Is there any easy way to se if a string consists only of numbers (ex int)
? I can't find any method in string for this, or is there maybe some try,
catch I can use before using something like int i = Int32.Parse(myString);
?

TIA
 
RegEx class
2. Is there any easy way to se if a string consists only of numbers (ex int)
? I can't find any method in string for this, or is there maybe some try,
catch I can use before using something like int i =
Int32.Parse(myString);
 
Hi again !

I have 2 more questions, and I know theyre simple for you guys, so I
hope you can help me.

1. Is there a c++ like command like system ? For example in c++ you
can use system("cd dir1"). I know this wouldnt go so well along with
compability on all platforms, but maybe there is such a command
anyway ?


System.Diagnostics.Process should do the job.
2. Is there any easy way to se if a string consists only of numbers
(ex int) ? I can't find any method in string for this, or is there
maybe some try, catch I can use before using something like int i =
Int32.Parse(myString); ?

TIA

int a=0;

try
{
a = Convert.ToInt32(someString);
}
catch(InvalidCastException ex)
{
//something went wrong on parsing
}



--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------
 
int a=0;
try
{
a = Convert.ToInt32(someString);
}
catch(InvalidCastException ex)
{
//something went wrong on parsing
}

Thanks, I always wanted to know how to do that.
 
Back
Top