Sen API
Sen Libraries
Loading...
Searching...
No Matches
string_utils.h
Go to the documentation of this file.
1// === string_utils.h ==================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_CORE_LANG_STRING_UTILS_H
9#define SEN_CORE_LANG_STRING_UTILS_H
10
11// std
12#include <string>
13#include <string_view>
14
15namespace sen
16{
17
19[[nodiscard]] std::string capitalizeAndRemoveSeparators(std::string_view str);
20
22[[nodiscard]] std::string snakeCaseToPascalCase(std::string_view str);
23
25[[nodiscard]] std::string pascalCaseToSnakeCase(std::string_view str);
26
28[[nodiscard]] bool isCapitalizedAndNoSeparators(std::string_view str);
29
30} // namespace sen
31
32#endif // SEN_CORE_LANG_STRING_UTILS_H
Definition assert.h:17
std::string capitalizeAndRemoveSeparators(std::string_view str)
Drops '-' and '_', and uppercases the first character (example: "foo_bar" -> "Foobar").
std::string pascalCaseToSnakeCase(std::string_view str)
Converts PascalCase to snake_case.
std::string snakeCaseToPascalCase(std::string_view str)
Splits on underscores and capitalizes (example: "foo_bar" -> "FooBar").
bool isCapitalizedAndNoSeparators(std::string_view str)
True when str starts with uppercase and contains no whitespace or underscores.