File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,11 +130,11 @@ void strTolower(std::string& str)
130130 });
131131}
132132
133- std::string trim (const std::string& s)
133+ std::string trim (const std::string& s, const std::string& t )
134134{
135- const std::string::size_type beg = s.find_first_not_of (" \t " );
135+ const std::string::size_type beg = s.find_first_not_of (t );
136136 if (beg == std::string::npos)
137137 return " " ;
138- const std::string::size_type end = s.find_last_not_of (" \t " );
138+ const std::string::size_type end = s.find_last_not_of (t );
139139 return s.substr (beg, end - beg + 1 );
140140}
Original file line number Diff line number Diff line change @@ -351,8 +351,9 @@ static inline const char* bool_to_string(bool b)
351351 * Remove heading and trailing whitespaces from the input parameter.
352352 * If string is all spaces/tabs, return empty string.
353353 * @param s The string to trim.
354+ * @param t The characters to trim.
354355 */
355- CPPCHECKLIB std::string trim (const std::string& s);
356+ CPPCHECKLIB std::string trim (const std::string& s, const std::string& t = " \t " );
356357
357358namespace cppcheck
358359{
You can’t perform that action at this time.
0 commit comments