From 2d132545b9d22143a6c3b0a05a74384eb33d4411 Mon Sep 17 00:00:00 2001 From: "J. Zhao" Date: Sat, 30 Mar 2019 08:36:15 +0300 Subject: [PATCH] strutils: revised documents --- str/strutils.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/str/strutils.h b/str/strutils.h index 962c679..5da8fb7 100644 --- a/str/strutils.h +++ b/str/strutils.h @@ -12,27 +12,29 @@ namespace strutils { /** * Split a full filename into three parts: base path, filename * without extension, and extension prefixed with '.'. + * * E.g., "~/work/test/cmp.sh" -> "~/work/test/", "cmp", ".sh" */ void splitFilename(const std::string &fullname, std::string &base, std::string &fnm_wo_ext, std::string &ext); /** - * Insert a short string into the middle of a filename, also replace extension - * if ext is non-empty. - * E.g., "./syn/event.dat", "test" --> "./syn/event_test.dat" + * Insert a short string into the middle of "filename" with the given extension + * "ext". If "ext" is empty, the file extension does not change. + * + * E.g., "./syn/event.dat", "test" --> "./syn/event_test.dat" * "./syn/event.dat", "test", "gz" --> "./syn/event_test.gz" */ std::string insertMiddle(const std::string &filename, const std::string &sufix, const std::string &ext = ""); /** - * return the base path of fullname, with '/' at the tail + * Return the base path of fullname, with '/' at the tail */ std::string getBasePath(const std::string &fullname); /** - * substitute the filename in fullname with given filename. + * Substitute the filename in fullname with given filename. */ std::string subFilename(const std::string &fullname, const std::string &filename); @@ -60,5 +62,5 @@ std::vector split(const std::string &s, const char delim); std::string trim_left(const std::string &str); std::string trim_right(const std::string &str); std::string trim(const std::string &str); -} +} // namespace strutils #endif /* __STRUTILS_H__ */