ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
string.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <string>
11 #include <vector>
12 
13 namespace colmap {
14 
15 // Format string by replacing embedded format specifiers with their respective
16 // values, see `printf` for more details. This is a modified implementation
17 // of Google's BSD-licensed StringPrintf function.
18 std::string StringPrintf(const char* format, ...);
19 
20 // Replace all occurrences of `old_str` with `new_str` in the given string.
21 std::string StringReplace(const std::string& str,
22  const std::string& old_str,
23  const std::string& new_str);
24 
25 // Get substring of string after search key
26 std::string StringGetAfter(const std::string& str, const std::string& key);
27 
28 // Split string into list of words using the given delimiters.
29 std::vector<std::string> StringSplit(const std::string& str,
30  const std::string& delim);
31 
32 // Check whether a string starts with a certain prefix.
33 bool StringStartsWith(const std::string& str, const std::string& prefix);
34 
35 // Remove whitespace from string on both, left, or right sides.
36 void StringTrim(std::string* str);
37 void StringLeftTrim(std::string* str);
38 void StringRightTrim(std::string* str);
39 
40 // Convert string to lower/upper case.
41 void StringToLower(std::string* str);
42 void StringToUpper(std::string* str);
43 
44 // Check whether the sub-string is contained in the given string.
45 bool StringContains(const std::string& str, const std::string& sub_str);
46 
47 } // namespace colmap
filament::Texture::InternalFormat format
std::string StringGetAfter(const std::string &str, const std::string &key)
Definition: string.cc:154
void StringTrim(std::string *str)
Definition: string.cc:188
bool StringStartsWith(const std::string &str, const std::string &prefix)
Definition: string.cc:173
std::string StringReplace(const std::string &str, const std::string &old_str, const std::string &new_str)
Definition: string.cc:140
void StringToLower(std::string *str)
Definition: string.cc:193
void StringLeftTrim(std::string *str)
Definition: string.cc:178
void StringRightTrim(std::string *str)
Definition: string.cc:183
std::vector< std::string > StringSplit(const std::string &str, const std::string &delim)
Definition: string.cc:166
std::string StringPrintf(const char *format,...)
Definition: string.cc:131
void StringToUpper(std::string *str)
Definition: string.cc:197
bool StringContains(const std::string &str, const std::string &sub_str)
Definition: string.cc:201