ATLAS Offline Software
Loading...
Searching...
No Matches
xAODMaker::Details Namespace Reference

Functions

std::string removePrefix (std::string_view str, std::string_view prefix)
 Remove a prefix from a string, if it exists.

Function Documentation

◆ removePrefix()

std::string xAODMaker::Details::removePrefix ( std::string_view str,
std::string_view prefix )

Remove a prefix from a string, if it exists.

Parameters
strThe string to process
prefixThe prefix to remove
Returns
The string without the prefix, or the original string if the prefix was not found

Definition at line 8 of file removePrefix.cxx.

8 {
9
10 if (str.starts_with(prefix)) {
11 return std::string(str.substr(prefix.size()));
12 }
13 return std::string(str);
14}