CbmRoot
Loading...
Searching...
No Matches
StlUtils.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Felix Weiglhofer [committer] */
4
5#include "StlUtils.h"
6
7using namespace cbm;
8
9std::string cbm::Capitalize(std::string_view str)
10{
11 if (str.empty()) {
12 return std::string(str);
13 }
14
15 std::string result(str);
16 result[0] = std::toupper(result[0]);
17 for (size_t i = 1; i < result.size(); ++i)
18 result[i] = std::tolower(result[i]);
19
20 return result;
21}
This file contains utility functions for STL containers.
std::string Capitalize(std::string_view str)
Capitalize the first letter of a string. The rest of the string is made lowercase.
Definition StlUtils.cxx:9