X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FParse.cs;fp=CarFire%2FCarFire%2FCarFire%2FParse.cs;h=2df3ca73028aadadc36013bb529593b988e38dfd;hp=b9320778babcbcdfb62d685aec9306ce2639d6c7;hb=722dcd763d115992b2a56d4001db80d11e583064;hpb=f6cf62c9a386ab97a2de922d500e27e4e1eff390 diff --git a/CarFire/CarFire/CarFire/Parse.cs b/CarFire/CarFire/CarFire/Parse.cs index b932077..2df3ca7 100644 --- a/CarFire/CarFire/CarFire/Parse.cs +++ b/CarFire/CarFire/CarFire/Parse.cs @@ -9,7 +9,8 @@ namespace CarFire { /// /// Class with handy static methods taking strings and returning objects - /// parsed from those strings. + /// parsed from those strings. For all of these functions, white space is + /// generally ignored, but any superfluous characters will make the parse fail. /// public class Parse { @@ -108,6 +109,18 @@ namespace CarFire return null; } + /// + /// Parses a single character. + /// + /// Text. + /// The character, or null if parsing failed. + public static char? Char(string atom) + { + string str = String(atom); + if (str != null && str.Length == 1) return str[0]; + return null; + } + /// /// Parses a constant from an enum. ///