string_helper.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdlib.h>
4 
5 inline bool startswith(std::string const& lhs, std::string const& rhs)
6 {
7  return lhs.rfind(rhs, 0) == 0;
8 }
9 
10 inline std::string expandPath(std::string const& path_)
11 {
12  std::string path(path_);
13  if (startswith(path, "~/"))
14  {
15  path = getenv("HOME") + std::string("/") + path.substr(2, std::string::npos);
16  }
17  return path;
18 }
expandPath
std::string expandPath(std::string const &path_)
Definition: string_helper.h:10
startswith
bool startswith(std::string const &lhs, std::string const &rhs)
Definition: string_helper.h:5


ensenso_camera
Author(s): Ensenso
autogenerated on Wed Apr 2 2025 02:37:46