Geant4-11
Functions
G4UIbatch.cc File Reference
#include "G4UIbatch.hh"
#include "G4UImanager.hh"
#include <vector>
#include <string>

Go to the source code of this file.

Functions

static void Tokenize (const G4String &str, std::vector< G4String > &tokens)
 

Function Documentation

◆ Tokenize()

static void Tokenize ( const G4String str,
std::vector< G4String > &  tokens 
)
static

Definition at line 37 of file G4UIbatch.cc.

38{
39 const char* delimiter = " ";
40
41 G4String::size_type pos0 = str.find_first_not_of(delimiter);
42 G4String::size_type pos = str.find_first_of(delimiter, pos0);
43
44 while(pos != G4String::npos || pos0 != G4String::npos)
45 {
46 if(str[pos0] == '\"')
47 {
48 pos = str.find_first_of("\"", pos0 + 1);
49 if(pos != G4String::npos)
50 pos++;
51 }
52 if(str[pos0] == '\'')
53 {
54 pos = str.find_first_of("\'", pos0 + 1);
55 if(pos != G4String::npos)
56 pos++;
57 }
58
59 tokens.push_back(str.substr(pos0, pos - pos0));
60 pos0 = str.find_first_not_of(delimiter, pos);
61 pos = str.find_first_of(delimiter, pos0);
62 }
63}
static const G4double pos

References pos.

Referenced by G4UIbatch::ReadCommand().