Ignore:
Timestamp:
12/06/23 03:32:58 (5 months ago)
Author:
Maciej Komosinski
Message:

Added helper functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/util-string.h

    r1276 r1288  
    1313char* strmove(char *a, char *b); //strcpy that works well for overlapping strings ("Source and destination overlap")
    1414bool str_starts_with(const char *str, const char *prefix);
    15 inline bool starts_with(const string& str, const char *prefix) { return str_starts_with(str.c_str(),prefix); } //std::string.starts_with(...) since c++20
     15inline bool starts_with(const string& str, const char *prefix) { return str_starts_with(str.c_str(), prefix); } //std::string.starts_with(...) since c++20
    1616bool ends_with(std::string_view str, std::string_view suffix);
     17bool strip_prefix(string& modify_me, const char* prefix); //@return true if the prefix is found and removed
    1718
    1819string ssprintf(const char* format, ...);
     
    2324string getFileDir(const string& filename); // get path component excluding filename ("" if no dir in file)
    2425string stripFileDir(const string& filename); // strip path component from filename
     26string concatPath(const string& path, const string& other_path); // concatenate paths, adding PATH_SEPARATOR_CHAR if necessary
    2527
    2628void ltrim_inplace(string &s);
Note: See TracChangeset for help on using the changeset viewer.