input mask source code 
Author Message
 input mask source code

Does anyone know of source code for matching templates against input strings
like "AAA-AAA-####" against a string, etc.  Thanks for any pointers.



Mon, 10 Nov 1997 03:00:00 GMT  
 input mask source code

Quote:

> Does anyone know of source code for matching templates against input strings
> like "AAA-AAA-####" against a string, etc.  Thanks for any pointers.

Locate a UNIX system and try "man regcmp", "man regex", "man lex" and
"man yacc".

Locate a UNIX system and look for files like "/usr/include/regex.h" and
"/usr/include/regexp.h"

Locate "The C Gazette", Volume 4, No. 4, for an article on finite state
automata, by Alan Holub

Locate "Algorithms" by Ian(?) Sedgewick

Locate "Compiler Design in C" by Allen I. Holub

Locate "Compilers, Principles, Techniques, and Tools" by Aho, Sethi, Ullman

Pat



Mon, 10 Nov 1997 03:00:00 GMT  
 input mask source code

Quote:
> Does anyone know of source code for matching templates against input strings
> like "AAA-AAA-####" against a string, etc.  Thanks for any pointers.

    User interface toolkits sometimes have stuff like this, to
    validate the input as the user is typing it (the best place to do
    it, IMHO), but for simple templates like the one you have there,
    it should be fairly easy to write your own. For example...

        int     jeff(sp,tp) /*======================================*/
        char    *sp;
        char    *tp;
        {
            while (*tp && *sp) {
                switch (*tp) {
                    case ('A'):
                        if (!isalpha(*sp)) return(0);
                        break;
                    case ('#'):
                        if (!isdigit(*sp)) return(0);
                        break;
                    default:
                        if (*tp != *sp) return(0);
                }
                tp++;
                sp++;
            }
            if (*tp || *sp) return(0);
            return(1);
        }

    You don't have to test for *sp in the loop condition, or for *tp
    in the last if statement, if you can trust the code in each case
    statement to do the right thing when *sp is zero.

--

***        "Puppet Boy, it's the little things that count" - DEVO       ***



Wed, 12 Nov 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. how to convert source code pascal to source code c

2. Creating Input Masks

3. Need to mask the input?

4. Input Masks

5. Masking Input with Asterisks

6. Masking input

7. Masking Input with Asterisks

8. Java source code to CSharp source code converter

9. anyone have masked edit control source?

10. HELP - ActiveX Masked Edit Control does NOT accept mask

11. Masking Control for Web Forms - code needed

12. mp3 source code ? - Source.zip (1/1)

 

 
Powered by phpBB® Forum Software