Different utilities for string processing. More...
#include <utilities/string_utilities.h>
Static Public Member Functions | |
static const char * | TrimRight (const char *Str, char *OutStr, char Ch) |
template<class str_type > | |
static str_type | TrimRight (const str_type &Str, char Ch) |
static const char * | TrimLeft (const char *Str, char *OutStr, char Ch) |
template<class str_type > | |
static str_type | TrimLeft (const str_type &Str, char Ch) |
Different utilities for string processing.
Definition at line 572 of file string_utilities.h.
const char * nitro::SUtils::TrimLeft | ( | const char * | Str, | |
char * | OutStr, | |||
char | Ch | |||
) | [static] |
Function deletes symbols from the beginning of the string.
Str | - Trimming string. | |
OutStr | - Timmed string. | |
Ch | - Symbol to be trimmed. |
nitro::exception | Throws exception with error description. |
Definition at line 206 of file string_utilities.cpp.
References nitro::exception::code(), and nitro::exception::what().
Referenced by TrimLeft().
{ try { memset( OutStr , 0 , strlen( Str ) + 1 ); std::size_t i( 0 ); for( ; i < strlen( Str ) && Str[ i ] == Ch ; i++ ); strncpy( OutStr , Str + i , strlen( Str ) - i ); return( OutStr ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "SUtils::TrimLeft( const char * Str , char * OutStr , char Ch )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "SUtils::TrimLeft( const char * Str , char * OutStr , char Ch )::An error occured" ) , 1 ) ); } }
str_type nitro::SUtils::TrimLeft | ( | const str_type & | Str, | |
char | Ch | |||
) | [static] |
Function deletes symbols from the beginning of the string.
Str | - Trimming string. | |
Ch | - Symbol to be trimmed. |
nitro::exception | Throws exception with error description. |
Definition at line 712 of file string_utilities.h.
References nitro::exception::code(), TrimLeft(), and nitro::exception::what().
{ try { return( TrimLeft( Str.c_str() , Ch ) ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "SUtils::TrimLeft( const str_type & Str , char Ch )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "SUtils::TrimLeft( const str_type & Str , char Ch )::An error occured" ) , 0 ) ); } }
const char * nitro::SUtils::TrimRight | ( | const char * | Str, | |
char * | OutStr, | |||
char | Ch | |||
) | [static] |
Function deletes ending simbols.
Str | - Trimming string. | |
OutStr | - Resulting string. | |
Ch | - Trimming symbol. |
nitro::exception | Throws exception with error description. |
Definition at line 182 of file string_utilities.cpp.
References nitro::exception::code(), and nitro::exception::what().
Referenced by TrimRight().
{ try { memset( OutStr , 0 , strlen( Str ) + 1 ); int i( ( int )strlen( Str ) - 1 ); for( ; i >= 0 && Str[ i ] == Ch ; i-- ); strncpy( OutStr , Str , i + 1 ); return( OutStr ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "SUtils::TrimRight( const char * Str , char * OutStr , char Ch )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "SUtils::TrimRight( const char * Str , char * OutStr , char Ch )::An error occured" ) , 1 ) ); } }
str_type nitro::SUtils::TrimRight | ( | const str_type & | Str, | |
char | Ch | |||
) | [static] |
Function deletes ending sibbols.
Str | -Trimming string. | |
Ch | - Trimming symbol. |
nitro::exception | Throws exception with error description. |
Definition at line 696 of file string_utilities.h.
References nitro::exception::code(), TrimRight(), and nitro::exception::what().
{ try { return( TrimRight( Str.c_str() , Ch ) ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "SUtils::TrimRight( const str_type & Str , char Ch )::" ) + e.what() , e.code() ) ); } catch( ... ) { throw( nitro::exception( std::string( "SUtils::TrimRight( const str_type & Str , char Ch )::An error occured" ) , 0 ) ); } }