This string parsing, while hokey, might be useful somewhere else.  Look in system.kod at AppendCardinalToTempString, which has some similarities.  Let's extract this logic into a new function in system.kod that takes a string and returns an integer (returning perhaps -1 if it doesn't match).