![]() |
Home | Libraries | People | FAQ | More |
boost::unit_test::utils::replace_all_occurrences_with_wildcards — This algorithm replaces all occurrences of a string with basic wildcards with another (optionally containing wildcards as well).
// In header: <boost/test/utils/algorithm.hpp> template<typename StringClass, typename ForwardIterator> StringClass replace_all_occurrences_with_wildcards(StringClass str, ForwardIterator it_string_to_find, ForwardIterator it_string_to_find_end, ForwardIterator it_string_to_replace, ForwardIterator it_string_to_replace_end);
The wildcard is the symbol '*'. Only a unique wildcard per string is supported. The replacement string may also contain a wildcard, in which case it is considered as a placeholder to the content of the wildcard in the source string. Example:
In order to replace the occurrences of 'time="some-variable-value"'
to a constant string, one may use 'time="*"'
as the string to search for, and 'time="0.0"' as the replacement string.
In order to replace the occurrences of 'file.cpp(XX)' per 'file.cpp:XX', where XX is a variable to keep, on may use 'file.cpp(*)'
as the string to search for, and 'file.cpp:*' as the replacement string.
Parameters: |
|