Strstr - C++ Reference
Có thể bạn quan tâm
cplusplus.com
This example searches for the "simple" substring in str and replaces that word for "sample". Output:
- TUTORIALS
- REFERENCE
- ARTICLES
- FORUM
C++
- Tutorials
- Reference
- Articles
- Forum
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
- C++11 <cfenv> (fenv.h)
- <cfloat> (float.h)
- C++11 <cinttypes> (inttypes.h)
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
- C++11 <cstdbool> (stdbool.h)
- <cstddef> (stddef.h)
- C++11 <cstdint> (stdint.h)
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
- C++11 <ctgmath> (tgmath.h)
- <ctime> (time.h)
- C++11 <cuchar> (uchar.h)
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
- C++11 <array>
- <deque>
- C++11 <forward_list>
- <list>
- <map>
- <queue>
- <set>
- <stack>
- C++11 <unordered_map>
- C++11 <unordered_set>
- <vector>
Input/Output:
- <fstream>
- <iomanip>
- <ios>
- <iosfwd>
- <iostream>
- <istream>
- <ostream>
- <sstream>
- <streambuf>
Multi-threading:
- C++11 <atomic>
- C++11 <condition_variable>
- C++11 <future>
- C++11 <mutex>
- C++11 <thread>
Other:
- <algorithm>
- <bitset>
- C++11 <chrono>
- C++11 <codecvt>
- <complex>
- <exception>
- <functional>
- C++11 <initializer_list>
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
- C++11 <random>
- C++11 <ratio>
- C++11 <regex>
- <stdexcept>
- <string>
- C++11 <system_error>
- C++11 <tuple>
- C++11 <type_traits>
- C++11 <typeindex>
- <typeinfo>
- <utility>
- <valarray>
<cstring> (string.h)
functions
- memchr
- memcmp
- memcpy
- memmove
- memset
- strcat
- strchr
- strcmp
- strcoll
- strcpy
- strcspn
- strerror
- strlen
- strncat
- strncmp
- strncpy
- strpbrk
- strrchr
- strspn
- strstr
- strtok
- strxfrm
types
- size_t
macro constants
- NULL
- Reference
- <cstring>
- strstr
Parameters
str1 C string to be scanned. str2 C string containing the sequence of characters to match.Return Value
A pointer to the first occurrence in str1 of the entire sequence of characters specified in str2, or a null pointer if the sequence is not present in str1.Portability
In C, this function is only declared as: char * strstr ( const char *, const char * ); instead of the two overloaded versions provided in C++.Example
| 1234567891011121314 | /* strstr example */ #include <stdio.h> #include <string.h> int main () { char str[] ="This is a simple string"; char * pch; pch = strstr (str,"simple"); if (pch != NULL) strncpy (pch,"sample",6); puts (str); return 0; } |
| This is a sample string |
See also
strspnGet span of character set in string (function)strpbrkLocate characters in string (function)strchrLocate first occurrence of character in string (function) Home page | Privacy policy© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s Spotted an error? contact usTừ khóa » Thư Viện Cstring C++
-
Các Hàm Trong Thư Viện Cstring C / C++ - Freetuts
-
6.2 Thư Viện String Trong C++
-
Các Thao Tác Trên Mảng Ký Tự (C-style Strings) | How Kteam
-
Cstring Trong C++ - Codefly.Vn
-
Các Hàm Trong Thư Viện Cstring C / C++
-
Các Hàm Trong Thư Viện Cstring - 123doc
-
Bài 57. Các Hàm Trong Thư Viện String.h - Lập Trình Không Khó
-
Khác Nhau Giữa Thư Viện Cstring.h Và String.h Như Thế Nào?
-
Xâu Trong C++ - VNOI
-
Thư Viện Chuẩn C++ – Wikipedia Tiếng Việt
-
Sự Khác Biệt Giữa
Và - HelpEx -
[PDF] Bài 9: Xâu - VNU-UET
-
Hàm Strcmp Trong C