CMS 3D CMS Logo

L1MuGMTLUTHelpers.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTLUTHelpers
8 //
9 //
10 // Author :
11 // H. Sakulin HEPHY Vienna
12 //
13 // Migrated to CMSSW:
14 // I. Mikulec
15 //
16 //--------------------------------------------------
17 
19 //---------------
20 // C++ Headers --
21 //---------------
22 #include <ctype.h>
23 
24 using namespace std;
25 
26 //--------------------------------------------------------------------------------
27 // Replace substring in string
28 
29 int L1MuGMTLUTHelpers::replace(string & input, const string& gone, const string& it, bool multiple) {
30  int n=0;
31  size_t i = input.find(gone,0);
32  while(i!=string::npos) {
33  n++;
34  input.replace(i,gone.size(),it);
35  i = input.find(gone,i+(multiple ? 0 : it.size()));
36  }
37  return n;
38 }
static std::string const input
Definition: EdmProvDump.cc:44
static int replace(std::string &input, const std::string &gone, const std::string &it, bool multiple)