A couple of folks asked, so here it is.

The scheme centers around pattern strings.  A pattern string represents 
one of any number of possible interpretations of a target string.  A 
pattern string consists of punctuation characters and the characters A 
and 9 representing consecutive sequences of alphabetical characters or 
digits.  At initialization time, a hash table is generated containing 
all possible legitimate target string patterns and respectiive rule codes.

At decode time, a target string is scanned constructing a) its pattern 
string and b) a vector of <address, length> of all alphabetic or numeric 
sequences found.  Since the max length of a legitimate pattern and the 
maximum number of possible sequences, these can be statically allocated.

Some sample string and corresponding patterns:

         9/5/2013                    9/9/9    with segments 9 5 2013
         5.9.13                           9.9.9    with segments 5 9 13
         September 5, 2013    A9,9       with segments September 5 2013

After a target string is scanned the hash table is checked for a 
matching pattern rule.  If found, resulting the rule is used as the 
argument for a case statement to apply the rule to the vector of segments.

There is usually a little more work to be done.  For dates, for example, 
it is necessary to validate day and month, look up alphabetic months, 
and expand two digit years, etc.




------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to