substring


A nonintrusive class that extends the functionality of the standard ANSI/ISO string.

Library

Helper<ToolKit>

Declaration

#include <ospace/helper/substr.h>

template< class BasicString >
class os_basic_substring

Typedefs

typedef os_basic_substring< string > os_substring;
typedef os_basic_substring< wstring > os_subwstring;

Interface

Constructor
os_substring( const string& s , size_t pos , size_t len )
Constructs a substring of string s , starting at position pos (default 0 ) with length len (default npos ) .

Throws: os_helper_toolkit_error

Constructor
os_substring( const os_substring& s )
Constructs a substring representing the same value as s .
=
void operator=( const char* s )
Assigns the value of this substring to s . This operation changes the original string and can invalidate other substrings of the same string.

Throws: os_helper_toolkit_error

=
void operator=( const string& s )
Assigns the value of this substring to s . This operation changes the original string and can invalidate other substrings of the same string.

Throws: os_helper_toolkit_error

[]
char operator[]( size_t pos ) const
Returns the character of this substring at position pos .

Throws: os_helper_toolkit_error

[]
char& operator[]( size_t pos )
Returns a reference to the character of this substring at position pos .

Throws: os_helper_toolkit_error

(string)
operator string()
Returns the value of this substring as a new string.
at
char at( size_t pos ) const
Returns the character of this substring at position pos .

Throws: os_helper_toolkit_error

at
char& at( size_t pos )
Returns a reference to the character of this substring at position pos .

Throws: os_helper_toolkit_error

empty
bool empty() const
Returns true if this substring is empty.
position
size_t position() const
Returns the starting position of this substring within the original string.

Throws: os_helper_toolkit_error

size
size_t size() const
Returns the length of this substring.
substring_of
string& substring_of() const
Returns a reference to original string.

Throws: os_helper_toolkit_error

to_string
string to_string() const
Returns the value of this substring as a new string.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.