有的时候需要检查某个字符串中是否有违法字符,以下提供了一种较为通用的方式进行检查:
//char_check.h
#ifndef CHAR_CHECK_H
#define CHAR_CHECK_H
#include <stdio.h>
#include <string.h>
typedef enum{
CHECK_NONE = 0x00000000,
CHECK_SPACE = 0x00000001,
CHECK_QUOTE = 0x00000002,
CHECK_DOUBLE_QUOTE = 0x00000004,
CHECK_BACK_QUOTE = 0x00000008,
CHECK_DOLLAR = 0x00000010,
CHECK_SLASH = 0x00000020,
CHECK_BACKSLASH = 0x00000040,
CHECK_COMMA = 0x00000080,
CHECK_PERIOD = 0x00000100,
CHECK_PERCENT =