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

来自cppreference.com
< cpp‎ | string‎ | char traits
(Use {{lc}}. Update links. Various fixes.)
 
(未显示2个用户的5个中间版本)
第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 |  
+
const *
const CharT* find( const CharT* p, std::size_t count, CharT a );
+
find( const * , std::size_t count, );
 
}}
 
}}
{{dcl end}}
 
  
Searches for character {{tt|a}} within the first {{tt|count}} characters within character string pointed to by {{tt|p}}.
+
{{|}} {{|count}} {{|}}
  
=== 参数 ===
+
 +
 
 +
===参数===
 
{{par begin}}
 
{{par begin}}
{{par | p | pointer to a character string to search}}
+
{{par|| }}
{{par | count | the number of characters to analyze}}
+
{{par|count| }}
{{par | a | the character to search for}}
+
{{par|| }}
 
{{par end}}
 
{{par end}}
  
===
+
===返回值===
返回值 ===
+
{{|}} {{| 。
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]]
+

2024年3月9日 (六) 09:51的最后版本


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

ptr 指向的字符序列的前 count 个字符中查找字符 ch

对字符特征的关于 X::find 的通用要求参考字符特征 (CharTraits)

[编辑] 参数

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

[编辑] 返回值

指向 [ptrptr + count) 所指定范围中首个比较等于 ch 的字符的指针,或在未找到时返回空指针。

[编辑] 复杂度

count 成线性。