source: cpp/common/util-string.h @ 1173

Last change on this file since 1173 was 1125, checked in by Maciej Komosinski, 4 years ago

Cosmetic

  • Property svn:eol-style set to native
File size: 1.2 KB
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
[1125]2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
[286]3// See LICENSE.txt for details.
[140]4
[840]5#ifndef _UTIL_STRINGS_H_
6#define _UTIL_STRINGS_H_
[140]7
8#include "nonstd_stl.h"
[180]9#include <stdarg.h>
[140]10
[1025]11string repr(const char *str);
12
[257]13char* strmove(char *a, char *b); //strcpy that works well for overlapping strings ("Source and destination overlap")
[913]14bool str_starts_with(const char *str, const char *prefix);
[1125]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
[257]16
[140]17string ssprintf(const char* format, ...);
[180]18string ssprintf_va(const char* format, va_list ap);
[140]19
20string stripExt(const string& filename); // strip extension from filename
[180]21string getFileExt(const string& filename); // get extension (starting with ".") from filename
[246]22string getFileDir(const string& filename); // get path component excluding filename ("" if no dir in file)
[460]23string stripFileDir(const string& filename); // strip path component from filename
[140]24
[1016]25void ltrim_inplace(string &s);
26void rtrim_inplace(string &s);
27void trim_inplace(string &s);
28string ltrim(string s);
29string rtrim(string s);
30string trim(string s);
31
[140]32#endif
Note: See TracBrowser for help on using the repository browser.