#2003 Observed Data : Add RiaStdStringTools

This commit is contained in:
Magne Sjaastad 2017-11-03 08:54:54 +01:00
parent bf8e4ed4ed
commit 3fa48d175f
3 changed files with 63 additions and 0 deletions

View File

@ -19,6 +19,7 @@ ${CEE_CURRENT_LIST_DIR}RiaImportEclipseCaseTools.h
${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.h
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.h
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.h
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -35,6 +36,7 @@ ${CEE_CURRENT_LIST_DIR}RiaImportEclipseCaseTools.cpp
${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.cpp
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.cpp
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.cpp
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaStdStringTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RiaStdStringTools::trimString(const std::string& s)
{
auto sCopy = s.substr(0, s.find_last_not_of(' ') + 1);
sCopy = sCopy.substr(sCopy.find_first_not_of(' '));
return sCopy;
}

View File

@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <string>
//==================================================================================================
//
//==================================================================================================
class RiaStdStringTools
{
public:
static std::string trimString(const std::string& s);
};