replace.hpp
来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 929 行 · 第 1/3 页
HPP
929 行
return find_format_copy( Input, last_finder(Search), const_formatter(Format) ); } //! Replace last algorithm /*! Replace the last match of the search string in the input with the format string. Input sequence is modified in-place. \param Input An input string \param Search A substring to be searched for \param Format A substitute string */ template<typename SequenceT, typename Range1T, typename Range2T> inline void replace_last( SequenceT& Input, const Range1T& Search, const Range2T& Format ) { find_format( Input, last_finder(Search), const_formatter(Format) ); }// replace_last ( case insensitive ) -----------------------------------------------// //! Replace last algorithm ( case insensitive ) /*! Replace the last match of the search string in the input with the format string. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. Searching is case insensitive. \param Output An output iterator to which the result will be copied \param Input An input string \param Search A substring to be searched for \param Format A substitute string \param Loc A locale used for case insensitive comparison \return An output iterator pointing just after the last inserted character or a modified copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template< typename OutputIteratorT, typename Range1T, typename Range2T, typename Range3T> inline OutputIteratorT ireplace_last_copy( OutputIteratorT Output, const Range1T& Input, const Range2T& Search, const Range3T& Format, const std::locale& Loc=std::locale() ) { return find_format_copy( Output, Input, last_finder(Search, is_iequal(Loc)), const_formatter(Format) ); } //! Replace last algorithm ( case insensitive ) /*! \overload */ template<typename SequenceT, typename Range1T, typename Range2T> inline SequenceT ireplace_last_copy( const SequenceT& Input, const Range1T& Search, const Range2T& Format, const std::locale& Loc=std::locale() ) { return find_format_copy( Input, last_finder(Search, is_iequal(Loc)), const_formatter(Format) ); } //! Replace last algorithm ( case insensitive ) /*! Replace the last match of the search string in the input with the format string.The input sequence is modified in-place. Searching is case insensitive. \param Input An input string \param Search A substring to be searched for \param Format A substitute string \param Loc A locale used for case insensitive comparison \return A reference to the modified input */ template<typename SequenceT, typename Range1T, typename Range2T> inline void ireplace_last( SequenceT& Input, const Range1T& Search, const Range2T& Format, const std::locale& Loc=std::locale() ) { find_format( Input, last_finder(Search, is_iequal(Loc)), const_formatter(Format) ); }// replace_nth --------------------------------------------------------------------// //! Replace nth algorithm /*! Replace an Nth (zero-indexed) match of the search string in the input with the format string. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. \param Output An output iterator to which the result will be copied \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. For negative N, matches are counted from the end of string. \param Format A substitute string \return An output iterator pointing just after the last inserted character or a modified copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template< typename OutputIteratorT, typename Range1T, typename Range2T, typename Range3T> inline OutputIteratorT replace_nth_copy( OutputIteratorT Output, const Range1T& Input, const Range2T& Search, int Nth, const Range3T& Format ) { return find_format_copy( Output, Input, nth_finder(Search, Nth), const_formatter(Format) ); } //! Replace nth algorithm /*! \overload */ template<typename SequenceT, typename Range1T, typename Range2T> inline SequenceT replace_nth_copy( const SequenceT& Input, const Range1T& Search, int Nth, const Range2T& Format ) { return find_format_copy( Input, nth_finder(Search, Nth), const_formatter(Format) ); } //! Replace nth algorithm /*! Replace an Nth (zero-indexed) match of the search string in the input with the format string. Input sequence is modified in-place. \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. For negative N, matches are counted from the end of string. \param Format A substitute string */ template<typename SequenceT, typename Range1T, typename Range2T> inline void replace_nth( SequenceT& Input, const Range1T& Search, int Nth, const Range2T& Format ) { find_format( Input, nth_finder(Search, Nth), const_formatter(Format) ); }// replace_nth ( case insensitive ) -----------------------------------------------// //! Replace nth algorithm ( case insensitive ) /*! Replace an Nth (zero-indexed) match of the search string in the input with the format string. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. Searching is case insensitive. \param Output An output iterator to which the result will be copied \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. For negative N, matches are counted from the end of string. \param Format A substitute string \param Loc A locale used for case insensitive comparison \return An output iterator pointing just after the last inserted character or a modified copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template< typename OutputIteratorT, typename Range1T, typename Range2T, typename Range3T> inline OutputIteratorT ireplace_nth_copy( OutputIteratorT Output, const Range1T& Input, const Range2T& Search, int Nth, const Range3T& Format, const std::locale& Loc=std::locale() ) { return find_format_copy( Output, Input, nth_finder(Search, Nth, is_iequal(Loc) ), const_formatter(Format) ); } //! Replace nth algorithm ( case insensitive ) /*! \overload */ template<typename SequenceT, typename Range1T, typename Range2T> inline SequenceT ireplace_nth_copy( const SequenceT& Input, const Range1T& Search, int Nth, const Range2T& Format, const std::locale& Loc=std::locale() ) { return find_format_copy( Input, nth_finder(Search, Nth, is_iequal(Loc)), const_formatter(Format) ); } //! Replace nth algorithm ( case insensitive ) /*! Replace an Nth (zero-indexed) match of the search string in the input with the format string. Input sequence is modified in-place. Searching is case insensitive. \param Input An input string \param Search A substring to be searched for \param Nth An index of the match to be replaced. The index is 0-based. For negative N, matches are counted from the end of string. \param Format A substitute string \param Loc A locale used for case insensitive comparison */ template<typename SequenceT, typename Range1T, typename Range2T> inline void ireplace_nth( SequenceT& Input, const Range1T& Search, int Nth, const Range2T& Format, const std::locale& Loc=std::locale() ) { find_format( Input, nth_finder(Search, Nth, is_iequal(Loc)), const_formatter(Format) ); }// replace_all --------------------------------------------------------------------// //! Replace all algorithm /*! Replace all occurrences of the search string in the input with the format string. The result is a modified copy of the input. It is returned as a sequence or copied to the output iterator. \param Output An output iterator to which the result will be copied \param Input An input string \param Search A substring to be searched for \param Format A substitute string \return An output iterator pointing just after the last inserted character or a modified copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template< typename OutputIteratorT, typename Range1T, typename Range2T, typename Range3T> inline OutputIteratorT replace_all_copy( OutputIteratorT Output, const Range1T& Input, const Range2T& Search, const Range3T& Format ) { return find_format_all_copy( Output, Input, first_finder(Search), const_formatter(Format) ); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?