. Topicala Page Index Token

A Journal about the experiences I have developing little applications in C#, Perl, Html and Javascript and talking about things new things that I use. Always Geeky; Always Nerdy; Always poor Grammer!

I am a Software Analyst Developer working in Southport, England but living in Liverpool. I develop mainly in C# and ASP.Net. I have been developing comercial software for several years now. I maintain this site (hosted at SwitchMedia UK) as a way of exploring new technologies (such as AJAX) and just generally talking about techie geek issues. This site is developed through a host of Perl scripts and a liberal use of Javascript. I enjoy experimenting with new technologies and anything that I make I host here.

Quick Search

Web www.kinlan.co.uk

Saturday, November 05, 2005

C# Query from Google

One of the queries that someone entered in to Google and found my site was:
c# test a string to see if it is a number:
I suppose there are a couple of ways that this can be done.

If you know the datatype that you want to convert it to [i.e you know the numeric range] you can use the Convert class.
Convert.ToInt16 (short), Convert.ToInt32 (int), Convert.ToFloat (floats). etc etc

You could also use a regex along the lines of:

/^[0-9]+$/
or
/^[\d]+$/

both of the above regex's will check to see if it is a numeric string. (Whole numbers only though).

Anyone who is looking for c# test a string to see if it is a number; I hope you find this usefull.

Technorati Tags
[feed], [feed], [feed], [feed]

Wikipedia Documents
Wikipedia: Regex ,Regular Expression

Comments: [Add New]