Geant4-11
Functions
anonymous_namespace{G4AnalysisUtilities.cc} Namespace Reference

Functions

G4bool GetToken (const G4String &line, G4String &token, std::string::size_type begIdx, std::string::size_type &endIdx)
 

Function Documentation

◆ GetToken()

G4bool anonymous_namespace{G4AnalysisUtilities.cc}::GetToken ( const G4String line,
G4String token,
std::string::size_type  begIdx,
std::string::size_type &  endIdx 
)

Definition at line 42 of file G4AnalysisUtilities.cc.

44{
45 while ( line[begIdx] == ' ') ++begIdx; // Loop checking, 23.06.2015, I. Hrivnacova
46 if ( line[begIdx] == '"' ) {
47 endIdx = line.find('"', begIdx+1);
48 if ( endIdx == std::string::npos ) endIdx = line.length();
49 token = line.substr(begIdx+1, (endIdx-1)-begIdx);
50 ++endIdx;
51 }
52 else {
53 endIdx = line.find(' ', begIdx);
54 if ( endIdx == std::string::npos ) endIdx = line.length();
55 token = line.substr(begIdx, endIdx-begIdx);
56 }
57 return ( token.length() > 0 );
58}

Referenced by G4Analysis::Tokenize().