473,414 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

2 more beginner questions

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
Nov 15 '05 #1
4 1033
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);

Nov 15 '05 #2
"H" <no*********************@hotmail.com> wrote in
news:kc********************@newsc.telia.net:
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------
Nov 15 '05 #3
> 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.
Nov 15 '05 #4
H

"Feisar Powi" <fs*****@rz.uni-potsdam.de> skrev i meddelandet
news:Ov**************@TK2MSFTNGP11.phx.gbl...
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.

Yep thanks from me too...
Stay tuned for more annoying questions

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Atip Asvanund | last post by:
Dear sirs, I am trying to learn how to use Boehm's garbage collector: http://www.hpl.hp.com/personal/Hans_Boehm/gc/ on a Linux machine. I am a beginner, and I find its documentation inadequate....
7
by: Rensjuh | last post by:
Hello, does someone have / know a good C++ tutorial for beginnners? I would prefer Dutch, but English is also fine. Hoi, heeft / kent iemand nog een goede C++ tutorial voor beginners? Het liefste...
15
by: Pelle Beckman | last post by:
Hi all, I have a few newbie questions: In function declaration what does a 'const' mean inside the parameter list ? That it won't modify the value? void MemberFunction(const int x);
12
by: Sathyaish | last post by:
Please forgive my nescience. I have worked extensively on Win32 but I am only familiar with C and C++. Lately, I have been practicing C from K&R. Here 're a few doubts I have written in the...
27
by: MHoffman | last post by:
I am just learning to program, and hoping someone can help me with the following: for a simple calculator, a string is entered into a text box ... how do I prevent the user from entering a text...
3
by: GoCoogs | last post by:
Is there a beginner VB.NET newsgroup or forum? I don't want to make you all laugh or take up your time with my "two weeks into VB.NET" questions. Thanks a lot -Blake
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
1
by: Robert J. Bonn | last post by:
I'm trying to set up a contact list in MS Access 97. I've looked through a reference book and the program's help screens, but the light bulb isn't quite coming on for me. If one of you could take...
10
by: See_Red_Run | last post by:
Hi, I am trying to figure out how to get started with PHP/MySQL. Everything I've read so far says to start with PHP first. I was expecting something like Visual Basic Express or some other type...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.