Unravel Engine C++ Reference
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
6namespace string_utils
7{
8
9using string_tokens_t = std::vector<std::string>;
10
11auto ltrim(const std::string& str) -> std::string;
12
13auto rtrim(const std::string& str) -> std::string;
14
15auto trim(const std::string& str) -> std::string;
16
17auto tokenize(const std::string& str, const std::string& delimiters) -> string_tokens_t;
18
19auto replace(const std::string& subject, const std::string& search, const std::string& replace) -> std::string;
20
21auto to_upper(const std::string& str) -> std::string;
22
23auto to_lower(const std::string& str) -> std::string;
24
25// Returns the first substring between "from - to" without trailing spaces
26auto extract_substring(const std::string& str, const std::string& from, const std::string& to) -> std::string;
27
28namespace alterable
29{
30void ltrim(std::string& str);
31
32void rtrim(std::string& str);
33
34void trim(std::string& str);
35
36void replace(std::string& subject, const std::string& search, const std::string& replace);
37
38void to_upper(std::string& str);
39
40void to_lower(std::string& str);
41} // namespace alterable
42
43} // namespace string_utils
void rtrim(std::string &str)
Definition utils.cpp:80
void replace(std::string &str, const std::string &search, const std::string &replace)
Definition utils.cpp:98
void to_lower(std::string &str)
Definition utils.cpp:124
void trim(std::string &str)
Definition utils.cpp:92
void to_upper(std::string &str)
Definition utils.cpp:113
void ltrim(std::string &str)
Definition utils.cpp:69
auto tokenize(const std::string &str, const std::string &delimiters) -> string_tokens_t
Definition utils.cpp:136
auto replace(const std::string &str, const std::string &search, const std::string &replace) -> std::string
Definition utils.cpp:28
auto extract_substring(const std::string &str, const std::string &from, const std::string &to) -> std::string
Definition utils.cpp:49
std::vector< std::string > string_tokens_t
Definition utils.h:9
auto to_lower(const std::string &str) -> std::string
Definition utils.cpp:42
auto trim(const std::string &str) -> std::string
Definition utils.cpp:21
auto ltrim(const std::string &str) -> std::string
Definition utils.cpp:7
auto to_upper(const std::string &str) -> std::string
Definition utils.cpp:35
auto rtrim(const std::string &str) -> std::string
Definition utils.cpp:14