Used single quotes for single character in string::find algorithm, more efficient

This commit is contained in:
asapelkin
2019-10-27 01:55:17 +03:00
committed by wmayer
parent e9814d9183
commit 8bc5b585c8
10 changed files with 11 additions and 11 deletions

View File

@@ -1023,7 +1023,7 @@ void FemMesh::readNastran(const std::string &Filename)
{
std::getline(inputfile,line1);
if (line1.size() == 0) continue;
if (!nastran_free_format && line1.find(",")!= std::string::npos)
if (!nastran_free_format && line1.find(',')!= std::string::npos)
nastran_free_format = true;
if (!nastran_free_format && line1.find("GRID*")!= std::string::npos ) //We found a Grid line
{

View File

@@ -1624,7 +1624,7 @@ bool MeshInput::LoadNastran (std::istream &rstrIn)
if (line.find("GRID*") == 0) {
assert(0);
}
else if (line.find("*") == 0) {
else if (line.find('*') == 0) {
assert(0);
}
// insert the read-in vertex into a map to preserve the order

View File

@@ -261,7 +261,7 @@ void Toolpath::setFromGCode(const std::string instr)
}
mode = "comment";
last = found;
found = str.find_first_of(")", found+1);
found = str.find_first_of(')', found+1);
} else if (str[found] == ')') {
// end of comment
std::string gcodestr = str.substr(last, found-last+1);

View File

@@ -343,7 +343,7 @@ bool PATLineSpec::findPatternStart(std::ifstream& inFile, std::string& parmName
(line.empty()) ) { //is cr/lf empty?
continue;
} else if (nameTag == "*") {
commaPos = line.find(",",1);
commaPos = line.find(',',1);
if (commaPos != std::string::npos) {
patternName = line.substr(1,commaPos-1);
} else {
@@ -396,7 +396,7 @@ std::vector<std::string> PATLineSpec::getPatternList(std::string& parmFile)
std::string nameTag = line.substr(0,1); //dupl code here
unsigned long int commaPos;
if (nameTag == "*") { //found a pattern
commaPos = line.find(",",1);
commaPos = line.find(',',1);
std::string patternName;
if (commaPos != std::string::npos) {
patternName = line.substr(1,commaPos-1);

View File

@@ -148,7 +148,7 @@ std::string LineGroup::getRecordFromFile(std::string parmFile, std::string group
(line.empty()) ) { //is cr/lf empty?
continue;
} else if (nameTag == "*") {
commaPos = line.find(",",1);
commaPos = line.find(',',1);
if (commaPos != std::string::npos) {
foundName = line.substr(1,commaPos-1);
} else {