string.hpp
Go to the documentation of this file.
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__
pinocchio::python::from
ReturnType & from(py::handle model)
Definition: pybind11.hpp:70
pinocchio::replace
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
pinocchio::python::to
py::object to(T &t)
Definition: pybind11.hpp:52
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sat Jun 22 2024 02:41:50