⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reg_assoc

📁 C实现的MUD,对大家基本入门网络游戏很有帮助!
💻
字号:
     rrrreeeegggg____aaaassssssssoooocccc((((3333))))           MMMMuuuuddddOOOOSSSS ((((22226666 DDDDeeeecccc 1111999999994444))))           rrrreeeegggg____aaaassssssssoooocccc((((3333))))     NNNNAAAAMMMMEEEE          reg_assoc() - A regular pattern substring extractor     SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS          mixed *reg_assoc(string str, string *pat_arr, mixed          *tok_arr, void | mixed def);     DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN          reg_assoc takes a string and explodes it into substrings          matching the regular expression pattern-strings given in          pat_arr and associates them with tokens given in tok_arr. If          def (default 0) is given, it is associated with a non-match.          The return value is an array of two arrays, the 1st being an          array of the form               ({ non-match1, match1, non-match2, match2, ...,                  non-match n, match n, non-match n+1 })          and the 2nd holds the tokens corresponding to the matches in          order:               ({ def, token corresponding to match1, ...., def,          token corresponding to match n, def }).          pat_arr and tok_arr must be of the same sizes, the ith          element in tok_arr being the corresponding token to the ith          element of pat_arr. pat_arr can only hold strings.          If pat_arr (and hence tok_arr) has size 0 then the return          value is simply ({ ({ str }), ({ def }) }).     EEEEXXXXAAAAMMMMPPPPLLLLEEEE          #define STRING_PAT "\"(\\\\.|[^\\\"])*\""          #define NUM_PAT "[0-9]+"          #define F_STRING 1          #define F_NUM 2          reg_assoc("Blah \"blah\" test 203 hhh j 308 \"bacdcd\b\"acb",            ({ STRING_PAT, NUM_PAT }), ({ F_STRING, F_NUM }), "no-match")          will return          ({ ({ "Blah ", "\"blah\"", " test ", "203", " hhh j ", "308", " ",                "\"bacdcd\b\"", "acb" }),             ({ "no-match", F_STRING, "no-match", F_NUM, "no-match", F_NUM,                "no-match", F_STRING, "no-match" }) })     Page 1                                          (printed 3/16/95)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -