[PD] Use compare to compare strings instead of substr
Used when finding subelements of a feature. Many of the comparisons used to also check for string lengths, but as far as I can tell they are not strictly necessary (see https://www.cplusplus.com/reference/string/string/substr/) and just `substr` can be used without them. However, `compare` explicitly is for comparing, and does not make a new object that `substr` does.
This commit is contained in:
@@ -85,7 +85,7 @@ App::DocumentObjectExecReturn *Loft::execute(void)
|
||||
// only take the entire shape when we have a sketch selected, but
|
||||
// not a point of the sketch
|
||||
if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) &&
|
||||
!(subName.size() > 6 && subName.substr(0,6) == "Vertex"))
|
||||
subName.compare(0, 6, "Vertex") != 0)
|
||||
return static_cast<Part::Part2DObject*>(feature)->Shape.getValue();
|
||||
else {
|
||||
if(subName.empty())
|
||||
|
||||
Reference in New Issue
Block a user