ATLAS Offline Software
Functions
GRLStrUtil Namespace Reference

Functions

void trim (std::string &input)
 
void split (const std::string &input, std::string &first, std::string &second)
 
std::vector< std::string > split (std::string input)
 

Function Documentation

◆ split() [1/2]

void GRLStrUtil::split ( const std::string &  input,
std::string &  first,
std::string &  second 
)

Definition at line 23 of file StrUtil.cxx.

23  {
24  // split input in two
25  string::size_type position = input.find_first_of(" \t\n");
26  if ( position==std::string::npos ) {
27  first = input;
28  second = "";
29  } else {
30  first = input.substr( 0, position );
31  second = input.substr( position+1, input.size()-position );
32  // trim leading whitespace of second
33  position= second.find_first_not_of(" \t\n");
34  second.erase(0, position);
35  }
36  }

◆ split() [2/2]

vector< string > GRLStrUtil::split ( std::string  input)

Definition at line 39 of file StrUtil.cxx.

39  {
40  trim(input);
41  vector<string> splitVec;
42  string first, second;
43  do {
45  if (!first.empty()) splitVec.push_back(first);
46  input = second;
47  } while(!input.empty());
48  return splitVec;
49  }

◆ trim()

void GRLStrUtil::trim ( std::string &  input)

Definition at line 12 of file StrUtil.cxx.

12  {
13  // trim leading and trailing whitespace
14  string::size_type position = input.find_first_not_of(" \t\n");
15  if ( position == std::string::npos ) return; // skip, it's all whitespace
16  input.erase(0, position);
17  position= input.find_last_not_of(" \t\n");
18  if ( position != std::string::npos)
19  input.erase( position+1 );
20  }
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
trim
std::string trim(const std::string &str, const std::string &whitespace=" \t")
Definition: BTaggingTruthTaggingTool.cxx:1149
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
DeMoScan.first
bool first
Definition: DeMoScan.py:534
Trk::split
@ split
Definition: LayerMaterialProperties.h:38