camel_case.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_GO_CAMEL_CASE_HPP
14 #define MLPACK_BINDINGS_GO_CAMEL_CASE_HPP
15 
16 namespace mlpack {
17 namespace bindings {
18 namespace go {
19 
24 inline std::string CamelCase(std::string s)
25 {
26  s[0] = std::toupper(s[0]);
27  size_t n = s.length();
28  size_t res_ind = 0;
29  for (size_t i = 0; i < n; i++)
30  {
31  // check for spaces in the sentence
32  if (s[i] == '_')
33  {
34  // conversion into upper case
35  s[i + 1] = toupper(s[i + 1]);
36  continue;
37  }
38  // If not space, copy character
39  else
40  s[res_ind++] = s[i];
41  }
42  // return string to main
43  return s.substr(0, res_ind);
44 }
45 
46 } // namespace go
47 } // namespace bindings
48 } // namespace mlpack
49 
50 #endif
std::string CamelCase(std::string s)
Given an snake_case like, e.g., "logistic_regression", return CamelCase(e.g.
Definition: camel_case.hpp:24
strip_type.hpp
Definition: add_to_po.hpp:21