Static Public Member Functions

nitro::SUtils Class Reference

Different utilities for string processing. More...

#include <utilities/string_utilities.h>

List of all members.

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)

Detailed Description

Different utilities for string processing.

Author:
Dodonov A.A.

Definition at line 572 of file string_utilities.h.


Member Function Documentation

const char * nitro::SUtils::TrimLeft ( const char *  Str,
char *  OutStr,
char  Ch 
) [static]

Function deletes symbols from the beginning of the string.

Parameters:
Str - Trimming string.
OutStr - Timmed string.
Ch - Symbol to be trimmed.
Returns:
Trimmed string.
Exceptions:
nitro::exception Throws exception with error description.
Author:
Dodonov A.A.

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 ) );
                }
        }

Here is the call graph for this function:

template<class str_type >
str_type nitro::SUtils::TrimLeft ( const str_type &  Str,
char  Ch 
) [static]

Function deletes symbols from the beginning of the string.

Parameters:
Str - Trimming string.
Ch - Symbol to be trimmed.
Returns:
Trimmed string.
Exceptions:
nitro::exception Throws exception with error description.
Author:
Dodonov A.A.

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 ) );
                }
        }

Here is the call graph for this function:

const char * nitro::SUtils::TrimRight ( const char *  Str,
char *  OutStr,
char  Ch 
) [static]

Function deletes ending simbols.

Parameters:
Str - Trimming string.
OutStr - Resulting string.
Ch - Trimming symbol.
Returns:
Trimmed string.
Exceptions:
nitro::exception Throws exception with error description.
Author:
Dodonov A.A.

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 ) );
                }
        }

Here is the call graph for this function:

template<class str_type >
str_type nitro::SUtils::TrimRight ( const str_type &  Str,
char  Ch 
) [static]

Function deletes ending sibbols.

Parameters:
Str -Trimming string.
Ch - Trimming symbol.
Returns:
Trimmed string.
Exceptions:
nitro::exception Throws exception with error description.
Author:
Dodonov A.A.

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 ) );
                }
        }
                

Here is the call graph for this function:


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.1