Replace duplicated trim (#5613)

pull/5614/head
Kim Kulling 2024-06-11 16:30:49 +02:00 committed by GitHub
parent e963a863ce
commit 75a10fedd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 18 deletions

View File

@ -343,7 +343,7 @@ void ObjFileMtlImporter::createMaterial() {
}
}
name = trim_whitespaces(name);
name = ai_trim(name);
std::map<std::string, ObjFile::Material *>::iterator it = m_pModel->mMaterialMap.find(name);
if (m_pModel->mMaterialMap.end() == it) {

View File

@ -577,7 +577,7 @@ void ObjFileParser::getMaterialDesc() {
// Get name
std::string strName(pStart, &(*m_DataIt));
strName = trim_whitespaces(strName);
strName = ai_trim(strName);
if (strName.empty()) {
skip = true;
}

View File

@ -247,22 +247,6 @@ inline char_t getFloat(char_t it, char_t end, ai_real &value) {
return it;
}
/**
* @brief Will remove white-spaces for a string.
* @param[in] str The string to clean
* @return The trimmed string.
*/
template <class string_type>
inline string_type trim_whitespaces(string_type str) {
while (!str.empty() && IsSpace(str[0])) {
str.erase(0);
}
while (!str.empty() && IsSpace(str[str.length() - 1])) {
str.erase(str.length() - 1);
}
return str;
}
/**
* @brief Checks for a line-end.
* @param[in] it Current iterator in string.