Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:57

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTLUTHelpers
0004 /**
0005  *   Description: String handling helper functions for L1MuGMTLUT
0006  * 
0007 */
0008 //
0009 //
0010 //   Author :
0011 //   H. Sakulin            HEPHY Vienna
0012 //
0013 //   Migrated to CMSSW:
0014 //   I. Mikulec
0015 //
0016 //--------------------------------------------------
0017 
0018 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLUTHelpers.h"
0019 //---------------
0020 // C++ Headers --
0021 //---------------
0022 #include <cctype>
0023 
0024 using namespace std;
0025 
0026 //--------------------------------------------------------------------------------
0027 // Replace substring in string
0028 
0029 int L1MuGMTLUTHelpers::replace(string& input, const string& gone, const string& it, bool multiple) {
0030   int n = 0;
0031   size_t i = input.find(gone, 0);
0032   while (i != string::npos) {
0033     n++;
0034     input.replace(i, gone.size(), it);
0035     i = input.find(gone, i + (multiple ? 0 : it.size()));
0036   }
0037   return n;
0038 }