mlpack
3.4.2
mlpack-3.4.2
src
mlpack
bindings
util
camel_case.hpp
Go to the documentation of this file.
1
12
#ifndef MLPACK_BINDINGS_UTIL_CAMEL_CASE_HPP
13
#define MLPACK_BINDINGS_UTIL_CAMEL_CASE_HPP
14
15
namespace
mlpack
{
16
namespace
util {
17
26
inline
std::string
CamelCase
(std::string s,
bool
lower)
27
{
28
if
(!lower)
29
s[0] = std::toupper(s[0]);
30
else
31
s[0] = std::tolower(s[0]);
32
size_t
n = s.length();
33
size_t
resInd = 0;
34
for
(
size_t
i = 0; i < n; i++)
35
{
36
// Check for spaces in the sentence.
37
if
(s[i] ==
'_'
)
38
{
39
// Conversion into upper case.
40
s[i + 1] = toupper(s[i + 1]);
41
continue
;
42
}
43
// If not space, copy character.
44
else
45
s[resInd++] = s[i];
46
}
47
// Return string to main.
48
return
s.substr(0, resInd);
49
}
50
51
}
// namespace util
52
}
// namespace mlpack
53
54
#endif
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition:
add_to_cli11.hpp:21
mlpack::util::CamelCase
std::string CamelCase(std::string s, bool lower)
Given an snake_case like, e.g., "logistic_regression", return CamelCase(e.g.
Definition:
camel_case.hpp:26
Generated by
1.8.20