// This file is a part of Framsticks SDK. http://www.framsticks.com/ // Copyright (C) 1999-2023 Maciej Komosinski and Szymon Ulatowski. // See LICENSE.txt for details. #ifndef _UTIL_STRINGS_H_ #define _UTIL_STRINGS_H_ #include "nonstd_stl.h" #include string repr(const char *str); char* strmove(char *a, char *b); //strcpy that works well for overlapping strings ("Source and destination overlap") bool str_starts_with(const char *str, const char *prefix); 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 bool ends_with(std::string_view str, std::string_view suffix); string ssprintf(const char* format, ...); string ssprintf_va(const char* format, va_list ap); string stripExt(const string& filename); // strip extension from filename string getFileExt(const string& filename); // get extension (starting with ".") from filename string getFileDir(const string& filename); // get path component excluding filename ("" if no dir in file) string stripFileDir(const string& filename); // strip path component from filename void ltrim_inplace(string &s); void rtrim_inplace(string &s); void trim_inplace(string &s); string ltrim(string s); string rtrim(string s); string trim(string s); #endif