I'm working to create a method that will verify whether a VIN number has a valid checksum. A description on the process can be found here: http://en.wikipedia.org/wiki/Vehicle_identification_number#Transliterating_the_numbers
Where I'm running into an issue is translating from the original data (sent as a string, currently I'm manipulating a char array) into integers for multiplication. I can't just convert the values to their ASCII values and mod them by 9, as the numbers S through Z don't line up with the rest.
Now I'm looking for a mildly efficient way to do this. My first thought was a switch statement, but that just seems excessively long. The next thing I thought of was a dictionary, and that seems like a pretty efficient way to do things. Regex seems like it would be overly complicated for the problem, and run into the issue of being almost as verbose as the switch statement.
So is a variable Dictionary vinDict the way to do it? Part of my gut feeling says that there's a really elegant way to do this with lambda syntax, but I don't know it well enough to do so.
Thanks in advance for any help!