📄 strstr.c
字号:
/*************************************************************************** Copyright Mentor Graphics Corporation 2002* All Rights Reserved.** THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS* SUBJECT TO LICENSE TERMS.**************************************************************************//************************************************************************** FILE NAME VERSION** strstr.c Nucleus Common Library 1.1** DESCRIPTION** This file contains the implementation of NCL_strstr.** DATA STRUCTURES** None.** FUNCTIONS** NCL_strstr** DEPENDENCIES** ncl.h* string.h* nucleus.h*************************************************************************/#define NU_NCL_SOURCE_FILE#include "ncl\inc\ncl.h"#include "ncl\inc\string.h"#include "plus\nucleus.h" /* MMU Support *//*************************************************************************** FUNCTION** NCL_strstr** DESCRIPTION** Return a pointer to first occurrence within string* s1 of string s2, or return zero if s1 does not* contain any instance of s2. If *s2 == 0, return s1.** INPUTS** s1 String to search within* s2 String to search for** OUTPUTS** char* Pointer to first occurance of s1 in s2 or 0 if* s1 does not contain any instance of s2.**************************************************************************/char *NCL_strstr(register const char *s1, register const char *s2){ register size_t len2; len2 = NCL_strlen(s2); if (!len2) { return (char *)s1; } for (; *s1; ++s1) { if (*s1 == *s2 && NCL_strncmp(s1, s2, len2)==0) { return (char *)s1; } } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -