“cpp/string/char traits/find”的版本间的差异

来自cppreference.com
< cpp‎ | string‎ | char traits
(Use {{lc}}. Update links. Various fixes.)
第1行: 第1行:
{{tr_note}}
 
 
{{cpp/string/char_traits/title|find}}
 
{{cpp/string/char_traits/title|find}}
 
{{cpp/string/char_traits/navbar}}
 
{{cpp/string/char_traits/navbar}}
 
{{dcl begin}}
 
{{dcl begin}}
{{dcl |  
+
{{dcl
const CharT* find( const CharT* p, std::size_t count, CharT a );
+
|  
 +
const * find( const * p, std::size_t count, );
 
}}
 
}}
 +
 +
 +
 +
 
{{dcl end}}
 
{{dcl end}}
  
Searches for character {{tt|a}} within the first {{tt|count}} characters within character string pointed to by {{tt|p}}.
+
{{tt|}} {{tt|count}} {{tt|}}
  
=== 参数 ===
+
===参数===
 
{{par begin}}
 
{{par begin}}
{{par | p | pointer to a character string to search}}
+
{{par | p | }}
{{par | count | the number of characters to analyze}}
+
{{par | count | }}
{{par | a | the character to search for}}
+
{{par | | }}
 
{{par end}}
 
{{par end}}
  
===
+
===返回值===
返回值 ===
+
{{tt|}}
A pointer to the first character of value {{tt|a}} withing the given character string.
+
  
=== 。例外。===
+
=== ===
{{tr|。 (无) 。|(none)}}
+
 (无)
  
=== 复杂 性。===
+
===复杂 ===
{{tr| 线性.|Linear.}}
+
{{|线性
  
[[de:cpp/string/char traits/find]]
+
deenesfritjaptru
[[en:cpp/string/char traits/find]]
+
[[es:cpp/string/char traits/find]]
+
[[fr:cpp/string/char traits/find]]
+
[[it:cpp/string/char traits/find]]
+
[[ja:cpp/string/char traits/find]]
+
[[pt:cpp/string/char traits/find]]
+
[[ru:cpp/string/char traits/find]]
+

2017年5月7日 (日) 06:00的版本


static const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
(C++17 前)
static constexpr const char_type* find( const char_type* p, std::size_t count, const char_type& ch );
(C++17 起)

p 所指字符序列的前 count 个字符中查找字符 ch

目录

参数

p - 指向要查找的字符串的指针
count - 要分析的字符数量
ch - 要查找的字符

返回值

指向 [p, p + count) 所指定范围中首个比较等于 ch 的字符的指针,或若未找到则为 NULL

异常

(无)

复杂度

count 成线性。