CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
stringTools.cc File Reference
#include "Utilities/General/interface/stringTools.h"

Go to the source code of this file.

Functions

int replace (string &input, const string &gone, const string &it, bool multiple)
 
int replaceRange (string &input, const string &first, const string &last, const string &it, bool multiple)
 
void strip (std::string &input, const std::string &blanks)
 

Function Documentation

int replace ( string &  input,
const string &  gone,
const string &  it,
bool  multiple 
)

Definition at line 5 of file stringTools.cc.

References i, and n.

5  {
6  int n=0;
7  size_t i = input.find(gone,0);
8  while(i!=string::npos) {
9  n++;
10  input.replace(i,gone.size(),it);
11  i = input.find(gone,i+(multiple ? 0 : it.size()));
12  }
13  return n;
14 }
int i
Definition: DBlmapReader.cc:9
int replaceRange ( string &  input,
const string &  first,
const string &  last,
const string &  it,
bool  multiple 
)

Definition at line 23 of file stringTools.cc.

References alignCSCRings::e, i, and n.

23  {
24  int n=0;
25  size_t i = input.find(first,0);
26  while(i!=string::npos) {
27  size_t e = input.find(last,i);
28  if (e!=string::npos) {
29  n++;
30  input.replace(i,e+last.size()-i,it);
31  i = input.find(first,i+(multiple ? 0 : it.size()));
32  } else break;
33  }
34  return n;
35 }
int i
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
void strip ( std::string &  input,
const std::string &  blanks 
)

Definition at line 16 of file stringTools.cc.

References b, and alignCSCRings::e.

Referenced by alignment.Alignment::__getConditions(), validateAlignments.ValidationJob::__getValidation(), argparse.HelpFormatter::_fill_text(), python.rootplot.argparse.HelpFormatter::_fill_text(), cmstc.TagCollector::_open(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor::_property(), extend_argparse.HelpFormatterRespectNewlines::_split_lines(), argparse.HelpFormatter::_split_lines(), python.rootplot.argparse.HelpFormatter::_split_lines(), CSCCLCTData::add(), CSCDigiToRaw::add(), Chamber_AutoCorrMat::add(), argparse.ArgumentParser::add_subparsers(), python.rootplot.argparse.ArgumentParser::add_subparsers(), CSCTMBHeader2006::addCLCT0(), CSCTMBHeader2007::addCLCT0(), CSCTMBHeader2006::addCLCT1(), CSCTMBHeader2007::addCLCT1(), PreshowerHitMaker::addHit(), MuonCSCChamberResidual::addResidual(), L1RPCConeBuilder::TCompressedCon::addStrip(), CalibrationAlgorithm::analyse(), NoiseAlgorithm::analyse(), PedestalsAlgorithm::analyse(), PedsOnlyAlgorithm::analyse(), CSCComparatorDigiValidation::analyze(), CSCDigiToPattern::analyze(), ESPedestalTask::analyze(), SiStripNoisesBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripNoisesReader::analyze(), SiStripPedestalsReader::analyze(), EcalABAnalyzer::analyze(), EcalPerEvtLaserAnalyzer::analyze(), SiStripBaselineValidator::analyze(), EcalTestPulseAnalyzer::analyze(), EcalPreshowerRecHitsValidation::analyze(), EcalLaserAnalyzer2::analyze(), EcalLaserAnalyzer::analyze(), SiStripBaselineAnalyzer::analyze(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::AnalyzeOccupancy(), ThreeThresholdAlgorithm::applyGains(), Chamber_AutoCorrMat::autocorrmat(), SiStripAPVRestorer::BaselineAndSaturationInspect(), SiStripAPVRestorer::BaselineFollowerInspect(), SiStripAPVRestorer::BaselineFollowerRestore(), FWRPCDigiProxyBuilder::build(), HPSPFRecoTauAlgorithm::buildOneProngStrip(), AlignableTracker::buildTRK(), CSCSectorReceiverLUT::calcGlobalPhiME(), CSCSectorReceiverMiniLUT::calcGlobalPhiMEMini(), CSCSectorReceiverMiniLUT::calcLocalPhiMini(), CSCPairResidualsConstraint::calculatePhi(), CalibrationScanTask::CalibrationScanTask(), CalibrationTask::CalibrationTask(), CSCChannelTranslator::channelFromStrip(), EcalElectronicsId::channelId(), HitEff::checkLayer(), CSCTMBHeader2006::CLCTDigis(), CSCTMBHeader2007::CLCTDigis(), CSCTMBHeader2007_rev0x50c3::CLCTDigis(), SiStripAPVRestorer::Cleaner_LocalMinimumAdder(), OldThreeThresholdAlgorithm::clusterizeDetUnit_(), SiStripMeanCMExtractor::CMExtractorFromPedestals(), CSCCLCTData::comparatorDigis(), CSCTMBHeader2006::CorrelatedLCTDigis(), CSCTMBHeader2007::CorrelatedLCTDigis(), CSCTMBHeader2007_rev0x50c3::CorrelatedLCTDigis(), SiStripAPVRestorer::CreateCMMapRealPed(), sistrip::DigiToRaw::createFedBuffers_(), SiStripThresholdGenerator::createObject(), EcalTBDaqFormatter::DecodeMEM(), EcalTB07DaqFormatter::DecodeMEM(), EcalPreshowerTopology::decrementIx(), EcalPreshowerTopology::decrementIy(), EcalPreshowerTopology::decrementIz(), EcalElectronicsMapper::deletePointers(), RPCReadOutMapping::detUnitFrame(), CSCCFEBData::digis(), SiStripCorrelateNoise::DoAnalysis(), CSCValidation::doCompTiming(), hitfit::Defaults_Textrep::doline(), Vispa.Main.Application.Application::doubleClickOnFile(), CSCCathodeLCTProcessor::dumpDigis(), SiStripApvShotCleaner::dumpInVector(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::dumpPython(), EcalDCCTB07UnpackingModule::EcalDCCTB07UnpackingModule(), python.XML2Python.TreeBuilder::endElement(), XML2Python.TreeBuilder::endElement(), TowerBlockFormatter::EndEvent(), Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::exportDot(), Vispa.Share.ImageExporter.ImageExporter::exportImage(), SiStripBadAPVAlgorithmFromClusterOccupancy::extractBadAPVs(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(), SiStripHotStripAlgorithmFromClusterOccupancy::extractBadStrips(), parserTimingReport::extractRSS_VSIZE(), checkforupdate.checkforupdate::fetchTagsHTTP(), LatencyTask::fill(), FineDelayTask::fill(), sistrip::FEDBufferPayloadCreator::fillClusterData(), RPCOccupancyTest::fillGlobalME(), popcon::SiStripPopConHandlerUnitTest< T >::fillObject(), popcon::SiStripPopConHandlerUnitTestNoise< T >::fillObject(), LaserAlignment::fillPedestalProfiles(), SiStripFedZeroSuppression::fillThresholds_(), CSCHitFromStripOnly::findHitOnStripPosition(), CSCCathodeLCTProcessor::findLCTs(), LASPeakFinder::FindPeakIn(), EndcapPiZeroDiscriminatorAlgo::findPi0Road(), PreshowerClusterAlgo::findRoad(), GlobalTrajectoryBuilderBase::fixTEC(), SiStripZeroSuppression::formatRawDigis(), utils_v2::get_version(), cmsPerfPublish::getcmd(), cmsPerfPublish::getcmdBasic(), RPCLogCone::getCompressedCone(), EcalElectronicsMapping::getDetId(), EcalElectronicsMapping::getElectronicsId(), EcalClusterLazyTools::getESHits(), CSCCathodeLCTProcessor::getKeyStripData(), parserPerfsuiteMetadata.parserPerfsuiteMetadata::getMachineInfo(), python.namespaceDict::getNamespaceDict(), popcon::EcalTPGWeightGroupHandler::getNewObjects(), popcon::EcalTPGSlidingWindowHandler::getNewObjects(), popcon::EcalTPGFineGrainStripEEHandler::getNewObjects(), SiStripNoises::getNoise(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::getObjectLabel(), SiStripPedestals::getPed(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::getShortLabel(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::getShortType(), EcalElectronicsMapping::getTriggerElectronicsId(), ESTBNumberingScheme::getUnitID(), EcalPreshowerNumberingScheme::getUnitID(), CSCValidation::getWidth(), Numbers::icEE(), EcalPreshowerTopology::incrementIx(), EcalPreshowerTopology::incrementIy(), EcalPreshowerTopology::incrementIz(), SiTrivialInduceChargeOnStrips::induce(), CastorText2DetIdConverter::init(), HcalText2DetIdConverter::init(), EcalTBDaqFormatter::interpretRawData(), EcalTB07DaqFormatter::interpretRawData(), TrajectoryAtInvalidHit::isDoubleSided(), HitEff::isDoubleSided(), LASProfileJudge::IsNegativePeaksInProfile(), LASProfileJudge::IsOverdrive(), LASProfileJudge::IsPeaksInProfile(), StripCPEfromTrackAngle::localParameters(), StripCPEgeometric::localParameters(), StripCPEfromTemplate::localParameters(), StripCPE::localParameters(), CSCSectorReceiverLUT::localPhi(), buildHistoTypes::main(), runall::main(), SiStripHashedDetIdESModule::make(), PFCandidateStripMerger::mergeCandidates(), SiStripZeroSuppression::MergeCollectionsZeroSuppression(), SiStripQuality::nBadStripsOnTheRight(), cmsCodeRulesChecker::omitLine(), Vispa.Plugins.Browser.BrowserPlugin.BrowserPlugin::openFile(), Vispa.Main.Application.Application::openFile(), reco::tau::RecoTauPiZeroStripPlugin::operator()(), reco::tau::RecoTauPiZeroStripPlugin2::operator()(), SiStripNoises::operator/(), operator<<(), cond::PayLoadInspector< DataT >::plot(), CSCCathodeLCTProcessor::preTrigger(), SiStripPedestals::printDebug(), CSCCathodeLCTProcessor::printPatterns(), ShallowRechitClustersProducer::produce(), ShallowTrackClustersProducer::produce(), ShallowSimhitClustersProducer::produce(), SiStripHashedDetIdESProducer::produce(), CSCTFUnpacker::produce(), ClusterShapeHitFilterESProducer::produce(), EcalTrivialConditionRetriever::produceEcalAlignmentES(), Strip1DMeasurementTransformator::projectionMatrix(), StripMeasurementTransformator::projectionMatrix(), FileNamesHelper::read_ConfigurationFromSimulationCandles(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor::recursePSetProperties(), CSCDigiValidator::relabelCompDigis(), CSCDigiValidator::relabelStripDigis(), EcalElectronicsMapper::resetPointers(), RPCLogCone::RPCLogCone(), CSCStripElectronicsSim::runComparator(), RPCPac::runEnergeticPatternsGroups(), EdgesToViz::runme(), checkforupdate.checkforupdate::runningVersion(), inputFilesetParser.inputFilesetParser::runsWithresult(), Vispa.Main.Application.Application::saveFileAsDialog(), CSCComparatorDigi::setStrip(), SiStripCondObjBuilderFromDb::setValuesCabling(), jptJetAnalysis::StripSignalOverNoiseCalculator::signalOverNoise(), RPCSimSimple::simulateNoise(), RPCSimTriv::simulateNoise(), RPCSimParam::simulateNoise(), RPCSimAverage::simulateNoise(), SiStripZeroSuppression::storeBaseline(), MedianCMNSubtractor::subtract_(), FastLinearCMNSubtractor::subtract_(), PercentileCMNSubtractor::subtract_(), SiStripApvShotCleaner::subtractCM(), SiStripFedZeroSuppression::suppress(), CSCMotherboard::testLCT(), CSCCathodeLCTProcessor::testPatterns(), TrajectoryAtInvalidHit::TrajectoryAtInvalidHit(), ZeroSuppressFP420::trkFEDclusterizer(), Vispa.Main.TabController.TabController::updateLabel(), ValidateGeometry::validateRPCGeometry(), ValidateGeometry::validateStripTopology(), Vispa.Main.Application.Application::windowTitle(), ESUnpacker::word2digi(), and Chamber_AutoCorrMat::zero().

16  {
17  size_t b = input.find_first_not_of(blanks);
18  if (b==std::string::npos) { input.clear(); return;}
19  size_t e = input.find_last_not_of(blanks);
20  input = input.substr(b,e-b+1);
21 }
double b
Definition: hdecay.h:120