changeset 17:dfb7cb94c169

Add number parser class with static method for ints no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Mon, 26 Jan 2009 20:30:03 +0000
parents 0352fa33ee8f
children 62fb27fd8c29
files CustomMath/NumberParser.cs IBBoard.mdp
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CustomMath/NumberParser.cs	Mon Jan 26 20:30:03 2009 +0000
@@ -0,0 +1,18 @@
+// This file (NumberParser.cs) is a part of the IBBoard utils library and is copyright 2009 IBBoard.
+//
+// The file and the library/program it is in are licensed under the GNU LGPL license. Please see COPYING.LGPL for more information and the full license.
+
+using System;
+
+namespace IBBoard
+{
+	public class NumberParser
+	{
+		public static int ParseAsInt(string numberString, int defaultValue)
+		{
+			int parsedValue = defaultValue;
+			int.TryParse(numberString, out parsedValue);
+			return parsedValue;
+		}
+	}
+}
--- a/IBBoard.mdp	Sun Jan 25 15:04:31 2009 +0000
+++ b/IBBoard.mdp	Mon Jan 26 20:30:03 2009 +0000
@@ -48,6 +48,7 @@
     <File name="Collections/DictionaryUtils.cs" subtype="Code" buildaction="Compile" />
     <File name="COPYING.GPL" subtype="Code" buildaction="Nothing" />
     <File name="COPYING.LGPL" subtype="Code" buildaction="Nothing" />
+    <File name="CustomMath/NumberParser.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />