?? instr.c
字號:
/* instr.c By Bill Kendrick New Breed Software kendrick@zippy.sonoma.edu http://zippy.sonoma.edu/kendrick/ June 27, 1996 - June 27, 1996 Added #include <string.h> - Sept. 22, 1997*/#include <string.h>#include "instr.h"/* Returns the location within "string" that "word" begins, or -1. */int instr(char * string, char * word){ int i, far, started, found; found = 0; started = -1; far = 0; if ((strlen(word) != 0) && (strlen(word) <= strlen(string))) { for (i = 0; i < strlen(string); i++) { if (string[i] == word[far]) { if (started == -1) started = i; far = far + 1; if (far == strlen(word)) { found = 1; far = 0; } } else { if (found == 0) { far = 0; started = -1; } } } } /* Make sure we found the WHOLE word, not just the beginning! */ if (found == 0) started = -1; return(started);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -