mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Performance : Use std::string when parsing address strings
This commit is contained in:
@@ -105,6 +105,17 @@ bool RiaStdStringTools::startsWithAlphabetic( const std::string& s )
|
||||
return isalpha( s[0] ) != 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::toUpper( const std::string& s )
|
||||
{
|
||||
auto strCopy( s );
|
||||
std::transform( strCopy.begin(), strCopy.end(), strCopy.begin(), []( unsigned char c ) { return std::toupper( c ); } );
|
||||
|
||||
return strCopy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -120,15 +131,25 @@ bool RiaStdStringTools::endsWith( const std::string& mainStr, const std::string&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::string> RiaStdStringTools::splitStringBySpace( const std::string& s )
|
||||
std::vector<std::string> RiaStdStringTools::splitString( const std::string& s, char delimiter )
|
||||
{
|
||||
std::vector<std::string> words;
|
||||
|
||||
splitByDelimiter( s, words );
|
||||
splitByDelimiter( s, words, delimiter );
|
||||
|
||||
return words;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::joinStrings( const std::vector<std::string>& s, char delimiter )
|
||||
{
|
||||
std::string delimiterString( 1, delimiter );
|
||||
|
||||
return join( s.begin(), s.end(), delimiterString );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user