]> Dogcows Code - chaz/carfire/blobdiff - CarFire/CarFire/CarFire/Parse.cs
Entity loading implemented.
[chaz/carfire] / CarFire / CarFire / CarFire / Parse.cs
index b9320778babcbcdfb62d685aec9306ce2639d6c7..2df3ca73028aadadc36013bb529593b988e38dfd 100644 (file)
@@ -9,7 +9,8 @@ namespace CarFire
 {\r
     /// <summary>\r
     /// Class with handy static methods taking strings and returning objects\r
-    /// parsed from those strings.\r
+    /// parsed from those strings.  For all of these functions, white space is\r
+    /// generally ignored, but any superfluous characters will make the parse fail.\r
     /// </summary>\r
     public class Parse\r
     {\r
@@ -108,6 +109,18 @@ namespace CarFire
             return null;\r
         }\r
 \r
+        /// <summary>\r
+        /// Parses a single character.\r
+        /// </summary>\r
+        /// <param name="atom">Text.</param>\r
+        /// <returns>The character, or null if parsing failed.</returns>\r
+        public static char? Char(string atom)\r
+        {\r
+            string str = String(atom);\r
+            if (str != null && str.Length == 1) return str[0];\r
+            return null;\r
+        }\r
+\r
         /// <summary>\r
         /// Parses a constant from an enum.\r
         /// </summary>\r
This page took 0.023131 seconds and 4 git commands to generate.