pinocchio  3.2.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
string.hpp
1 //
2 // Copyright (c) 2021 INRIA
3 //
4 
5 #ifndef __pinocchio_utils_string_hpp__
6 #define __pinocchio_utils_string_hpp__
7 
8 #include <string>
9 
10 namespace pinocchio
11 {
12 
22  inline bool replace(std::string & input_str, const std::string & from, const std::string & to)
23  {
24  bool has_from = false;
25  size_t start_pos = input_str.find(from);
26 
27  while (start_pos != std::string::npos)
28  {
29  has_from = true;
30  input_str.replace(start_pos, from.length(), to);
31  start_pos = input_str.find(from);
32  }
33 
34  return has_from;
35  }
36 } // namespace pinocchio
37 
38 #endif // __pinocchio_utils_string_hpp__
Main pinocchio namespace.
Definition: treeview.dox:11
bool replace(std::string &input_str, const std::string &from, const std::string &to)
Replace string from with to in input_str.
Definition: string.hpp:22