Last change
on this file since 1097 was
1025,
checked in by Maciej Komosinski, 4 years ago
|
Added a repr() function that converts a string using only printable characters or ascii codes when necessary
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
2 | // Copyright (C) 1999-2020 Maciej Komosinski and Szymon Ulatowski. |
---|
3 | // See LICENSE.txt for details. |
---|
4 | |
---|
5 | #ifndef _UTIL_STRINGS_H_ |
---|
6 | #define _UTIL_STRINGS_H_ |
---|
7 | |
---|
8 | #include "nonstd_stl.h" |
---|
9 | #include <stdarg.h> |
---|
10 | |
---|
11 | string repr(const char *str); |
---|
12 | |
---|
13 | char* strmove(char *a, char *b); //strcpy that works well for overlapping strings ("Source and destination overlap") |
---|
14 | bool str_starts_with(const char *str, const char *prefix); |
---|
15 | inline bool starts_with(string& str, const char *prefix) { return str_starts_with(str.c_str(),prefix); } //std::string.starts_with(...) since c++20 |
---|
16 | |
---|
17 | string ssprintf(const char* format, ...); |
---|
18 | string ssprintf_va(const char* format, va_list ap); |
---|
19 | |
---|
20 | string stripExt(const string& filename); // strip extension from filename |
---|
21 | string getFileExt(const string& filename); // get extension (starting with ".") from filename |
---|
22 | string getFileDir(const string& filename); // get path component excluding filename ("" if no dir in file) |
---|
23 | string stripFileDir(const string& filename); // strip path component from filename |
---|
24 | |
---|
25 | void ltrim_inplace(string &s); |
---|
26 | void rtrim_inplace(string &s); |
---|
27 | void trim_inplace(string &s); |
---|
28 | string ltrim(string s); |
---|
29 | string rtrim(string s); |
---|
30 | string trim(string s); |
---|
31 | |
---|
32 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.