/* Strchr */ /* This function is used to locate the first occurrence of a character in a string. */ /* If it is found, the absolute address is returned. If it is not found, null is returned. */ Char * /* Returns the absolute position of the first occurrence of a string. */ My_strchr ( Const Char * SRC,/* String to be searched */ Char Ch /* Characters to be searched */ ){ While (* SRC! = CH) /* Test from the first character. If not equal, null is returned. */ { If (* Src = ' \ 0 ' ) Return NULL; SRC ++; /* Point to the next character */ } Return ( Char *) SRC; /* This is returned only when the first character is the character to be searched. */ } /* Strrchr */ /* This function returns the position of the last occurrence of a character in the string. */ /* Locate: returns the absolute position. Not found: returns NULL */ Char * My_strrchr ( Const Char * SRC, /* String to be searched */ Char Ch /* Characters to be searched */ ){ Const Char * PTR; For (PTR = NULL; ++ SRC) /* Match from the first character */ { If (* Src = CH) /* No value can be reassigned once. */ PTR = SRC; If (* Src = ' \ 0 ' ) /* End of arrival */ Return ( Char * ) PTR;} the girl does not cry (QQ: 191035066 )@ 2012 - 05 -29 16 : 51 : 48 @ Http: // Www.cnblogs.com/nbsofer