casacore
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all members
casacore::String Class Reference


String: the storage and methods of handling collections of characters. More...

#include <String.h>

Public Types

typedef string::traits_type traits_type
 
typedef string::value_type value_type
 
typedef string::allocator_type allocator_type
 
typedef string::size_type size_type
 
typedef string::difference_type difference_type
 
typedef string::reference reference
 
typedef string::const_reference const_reference
 
typedef string::pointer pointer
 
typedef string::const_pointer const_pointer
 
typedef string::iterator iterator
 
typedef string::const_iterator const_iterator
 
typedef string::reverse_iterator reverse_iterator
 
typedef string::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 String ()
 Default constructor. More...
 
 String (const string &str, size_type pos=0, size_type n=npos)
 Construct from std string Construct from (part of) other string: acts as copy constructor. More...
 
 String (const Char *s, size_type n)
 Construct from char* with given length. More...
 
 String (const Char *s)
 Construct from char array. More...
 
 String (size_type n, Char c)
 Construct from a single char (repeated n times) More...
 
template<class InputIterator >
 String (InputIterator begin, InputIterator end)
 Construct from iterator. More...
 
 String (Char c)
 From single char (** Casacore addition). More...
 
 String (const SubString &str)
 Construct from a SubString. More...
 
 String (ostringstream &os)
 Construct from a stream. More...
 
 ~String ()
 Destructor. More...
 
Stringoperator= (const string &str)
 Assignments (they are all deep copies according to standard) More...
 
Stringoperator= (const SubString &str)
 
Stringoperator= (const Char *s)
 
Stringoperator= (Char c)
 
SubString operator() (size_type pos, size_type len)
 Casacore addition: synonym for at(pos, len) More...
 
Stringoperator+= (const string &str)
 Concatenate. More...
 
Stringoperator+= (const Char *s)
 
Stringoperator+= (Char c)
 
const_reference operator[] (size_type pos) const
 Indexing. More...
 
reference operator[] (size_type pos)
 
const_reference elem (size_type pos) const
 *** Casacore addition More...
 
Char firstchar () const
 
Char lastchar () const
 
iterator begin ()
 Iterators. More...
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_type size () const
 Capacity, size. More...
 
size_type length () const
 
size_type max_size () const
 
size_type capacity () const
 
Int allocation () const
 ** Casacore addition – works as a capacity(n) – Note Int More...
 
Stringresize (size_type n)
 Resize by truncating or extending with copies of c (default Char()) More...
 
Stringresize (size_type n, Char c)
 
Stringreserve (size_type res_arg=0)
 
void alloc (size_type n)
 ** Casacore addition – works as a resize(n) More...
 
void clear ()
 Clear the string
Warning: clear() executed as erase() due to missing clear() in gcc

More...
 
Bool empty () const
 Test for empty. More...
 
const_reference at (size_type n) const
 Addressing. More...
 
reference at (size_type n)
 
Stringappend (const string &str)
 Append. More...
 
Stringappend (const string &str, size_type pos, size_type n)
 
Stringappend (const Char *s, size_type n)
 
Stringappend (const Char *s)
 
Stringappend (size_type n, Char c)
 
template<class InputIterator >
Stringappend (InputIterator first, InputIterator last)
 
Stringappend (Char c)
 ** Casacore addition More...
 
Stringassign (const string &str)
 Assign. More...
 
Stringassign (const string &str, size_type pos, size_type n)
 
Stringassign (const Char *s, size_type n)
 
Stringassign (const Char *s)
 
Stringassign (size_type n, Char c)
 
template<class InputIterator >
Stringassign (InputIterator first, InputIterator last)
 
Stringassign (Char c)
 ** Casacore addition More...
 
Stringinsert (size_type pos1, const string &str)
 Insert. More...
 
Stringinsert (size_type pos1, const string &str, size_type pos2, size_type n)
 
Stringinsert (size_type pos, const Char *s, size_type n)
 
Stringinsert (size_type pos, const Char *s)
 
Stringinsert (size_type pos, size_type n, Char c)
 
Stringinsert (size_type pos, Char c)
 ** Casacore addition More...
 
iterator insert (iterator p, Char c)
 
void insert (iterator p, size_type n, Char c)
 
template<class InputIterator >
void insert (iterator p, InputIterator first, InputIterator last)
 
Stringinsert (iterator p, const string &str)
 ** Casacore additions More...
 
Stringinsert (iterator p, const Char *s, size_type n)
 
Stringinsert (iterator p, const Char *s)
 
Int compare (const string &str) const
 Compare. More...
 
Int compare (size_type pos1, size_type n1, const string &str) const
 
Int compare (size_type pos1, size_type n1, const string &str, size_type pos2, size_type n2) const
 
Int compare (const Char *s) const
 
Int compare (size_type pos1, size_type n1, const Char *s, size_type n2=npos) const
 
Stringerase (size_type pos, size_type n=npos)
 Erase. More...
 
iterator erase (iterator position)
 
iterator erase (iterator first, iterator last)
 
Stringreplace (size_type pos1, size_type n1, const string &str)
 Replace. More...
 
Stringreplace (size_type pos1, size_type n1, const string &str, size_type pos2, size_type n2)
 
Stringreplace (size_type pos, size_type n1, const Char *s, size_type n2)
 
Stringreplace (size_type pos, size_type n1, const Char *s)
 
Stringreplace (size_type pos, size_type n1, size_type n2, Char c)
 
Stringreplace (size_type pos, size_type n1, Char c)
 ** Casacore addition More...
 
Stringreplace (iterator i1, iterator i2, const string &str)
 
Stringreplace (iterator i1, iterator i2, const Char *s, size_type n)
 
Stringreplace (iterator i1, iterator i2, const Char *s)
 
Stringreplace (iterator i1, iterator i2, size_type n, Char c)
 
Stringreplace (iterator i1, iterator i2, Char c)
 ** Casacore addition More...
 
template<class InputIterator >
Stringreplace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)
 
size_type copy (Char *s, size_type n, size_type pos=0) const
 Copy. More...
 
void swap (string &s)
 Swap. More...
 
const Charc_str () const
 Get char array. More...
 
const Chardata () const
 As pointer to char array
More...
 
const Charchars () const
 ** Casacore synonym More...
 
allocator_type get_allocator () const
 Get allocator used
Warning: gcc has no get_allocator()
More...
 
String substr (size_type pos=0, size_type n=npos) const
 Get a sub string. More...
 
template<typename T >
Bool fromString (T &value, Bool chk=True) const
 Convert a String to a value. More...
 
template<typename T >
fromString () const
 
void trim ()
 Remove beginning and ending whitespace. More...
 
void trim (char c[], uInt n)
 Remove specified chars from beginning and end of string. More...
 
void ltrim (char c)
 Remove specified character from beginning of string. More...
 
void rtrim (char c)
 Remove specified character from end of string. More...
 
Bool startsWith (const string &beginString) const
 Does the string start with the specified string? More...
 
size_type find (const string &str, size_type pos=0) const
 Search functions. More...
 
size_type find (const Char *s, size_type pos=0) const
 
size_type find (const Char *s, size_type pos, size_type n) const
 
size_type find (Char c, size_type pos=0) const
 
size_type find (const Regex &r, size_type pos=0) const
 
size_type rfind (const string &str, size_type pos=npos) const
 
size_type rfind (const Char *s, size_type pos=npos) const
 
size_type rfind (const Char *s, size_type pos, size_type n) const
 
size_type rfind (Char c, size_type pos=npos) const
 
size_type find_first_of (const string &str, size_type pos=0) const
 
size_type find_first_of (const Char *s, size_type pos=0) const
 
size_type find_first_of (const Char *s, size_type pos, size_type n) const
 
size_type find_first_of (Char c, size_type pos=0) const
 
size_type find_last_of (const string &str, size_type pos=npos) const
 
size_type find_last_of (const Char *s, size_type pos=npos) const
 
size_type find_last_of (const Char *s, size_type pos, size_type n) const
 
size_type find_last_of (Char c, size_type pos=npos) const
 
size_type find_first_not_of (const string &str, size_type pos=0) const
 
size_type find_first_not_of (const Char *s, size_type pos=0) const
 
size_type find_first_not_of (const Char *s, size_type pos, size_type n) const
 
size_type find_first_not_of (Char c, size_type pos=0) const
 
size_type find_last_not_of (const string &str, size_type pos=npos) const
 
size_type find_last_not_of (const Char *s, size_type pos=npos) const
 
size_type find_last_not_of (const Char *s, size_type pos, size_type n) const
 
size_type find_last_not_of (Char c, size_type pos=npos) const
 
Bool contains (Char c) const
 Containment. More...
 
Bool contains (const string &str) const
 
Bool contains (const Char *s) const
 
Bool contains (const Regex &r) const
 
Bool contains (Char c, Int pos) const
 Does the string starting at the given position contain the given substring? If the position is negative, it is counted from the end. More...
 
Bool contains (const string &str, Int pos) const
 
Bool contains (const Char *s, Int pos) const
 
Bool contains (const Regex &r, Int pos) const
 
Bool matches (const string &str, Int pos=0) const
 Matches entire string from pos (or till pos if negative pos). More...
 
Bool matches (Char c, Int pos=0) const
 
Bool matches (const Char *s, Int pos=0) const
 
Bool matches (const Regex &r, Int pos=0) const
 
void prepend (const string &str)
 Concatenate by prepending the argument onto String. More...
 
void prepend (const Char *s)
 
void prepend (Char c)
 
size_type index (Char c, Int startpos=0) const
 Return the position of the target in the string or npos for failure. More...
 
size_type index (const string &str, Int startpos=0) const
 
size_type index (const Char *s, Int startpos=0) const
 
size_type index (const Regex &r, Int startpos=0) const
 
Int freq (Char c) const
 Return the number of occurences of target in String. More...
 
Int freq (const string &str) const
 
Int freq (const Char *s) const
 
SubString at (size_type pos, size_type len)
 Extract the string "at" the argument's position. More...
 
String at (size_type pos, size_type len) const
 
SubString at (const string &str, Int startpos=0)
 
String at (const string &str, Int startpos=0) const
 
SubString at (const Char *s, Int startpos=0)
 
String at (const Char *s, Int startpos=0) const
 
SubString at (Char c, Int startpos=0)
 
String at (Char c, Int startpos=0) const
 
SubString at (const Regex &r, Int startpos=0)
 
String at (const Regex &r, Int startpos=0) const
 
SubString at (Int pos, Int len)
 Next ones for overloading reasons. More...
 
String at (Int pos, Int len) const
 
SubString at (Int pos, size_type len)
 
String at (Int pos, size_type len) const
 
SubString before (size_type pos) const
 Start at startpos and extract the string "before" the argument's position, exclusive. More...
 
SubString before (const string &str, size_type startpos=0) const
 
SubString before (const Char *s, size_type startpos=0) const
 
SubString before (Char c, size_type startpos=0) const
 
SubString before (const Regex &r, size_type startpos=0) const
 
SubString before (Int pos) const
 Next one for overloading reasons. More...
 
SubString through (size_type pos)
 Start at startpos and extract the SubString "through" to the argument's position, inclusive. More...
 
SubString through (const string &str, size_type startpos=0)
 
SubString through (const Char *s, size_type startpos=0)
 
SubString through (Char c, size_type startpos=0)
 
SubString through (const Regex &r, size_type startpos=0)
 
SubString through (Int pos)
 Next one for overloading reasons. More...
 
SubString from (size_type pos)
 Start at startpos and extract the SubString "from" the argument's position, inclusive, to the String's end. More...
 
SubString from (const string &str, size_type startpos=0)
 
SubString from (const Char *s, size_type startpos=0)
 
SubString from (Char c, size_type startpos=0)
 
SubString from (const Regex &r, size_type startpos=0)
 
SubString from (Int pos)
 Next one for overloading reasons. More...
 
SubString after (size_type pos)
 Start at startpos and extract the SubString "after" the argument's position, exclusive, to the String's end. More...
 
SubString after (const string &str, size_type startpos=0)
 
SubString after (const Char *s, size_type startpos=0)
 
SubString after (Char c, size_type startpos=0)
 
SubString after (const Regex &r, size_type startpos=0)
 
SubString after (Int pos)
 Next one for overloading reasons. More...
 
void reverse ()
 Maybe forget some. More...
 
void capitalize ()
 internal transformation to capitalization of String. More...
 
void upcase ()
 internal transformation to uppercase of String More...
 
void downcase ()
 internal transformation to lowercase of String More...
 
void del (size_type pos, size_type len)
 Delete len chars starting at pos. More...
 
void del (const string &str, size_type startpos=0)
 Delete the first occurrence of target after startpos. More...
 
void del (const Char *s, size_type startpos=0)
 
void del (Char c, size_type startpos=0)
 
void del (const Regex &r, size_type startpos=0)
 
void del (Int pos, Int len)
 Overload problem. More...
 
Int gsub (const string &pat, const string &repl)
 Global substitution: substitute all occurrences of pat with repl, and return the number of replacements. More...
 
Int gsub (const Char *pat, const string &repl)
 
Int gsub (const Char *pat, const Char *repl)
 
Int gsub (const Regex &pat, const string &repl)
 

Static Public Member Functions

static String format (const char *picture,...)
 Create a formatted string using the given printf format string. More...
 
static Int toInt (const String &s, Bool chk=False)
 Convert a string to an Int, Float or Double. More...
 
static Float toFloat (const String &s, Bool chk=False)
 
static Double toDouble (const String &s, Bool chk=False)
 
template<typename T >
static String toString (const T &value)
 Convert a value to a String. More...
 

Static Public Attributes

static const size_type npos
 

Private Member Functions

SubString _substr (size_type first, size_type l) const
 Helper functions for at, before etc. More...
 
void throwFromStringError () const
 Helper function for fromString. More...
 

Detailed Description


String: the storage and methods of handling collections of characters.

Intended use:

Public interface

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Test programs:
tString

Prerequisite

Etymology

The String class name is a continuation of the "C" language custom of refering to collections of characters as "strings of characters".

Synopsis

The String class is the Casacore implementation of a string class. It is from the standard library string class, and all operations and behaviour of strings as defined in the standard are available for a String. The only difference is the extension with additional functions in the Casacore String class as compared to the standard string class.

The String class may be instantiated in many ways:

  1. A single character - String myChar('C');
  2. A Char* argument - String myWord("Yowza");
  3. The first n chararcters of a pre-existing string - String myFoo("fooey", 3);

As well as the copy and default constructors and iterator based ones.

A String may be concatinated with another object (String, or char*) with either prepending or postpending. A search for the position of a character within a String may return its position, a Bool that it is contained within or a Bool confirming your guess at the character's position is correct. A check of the frequency of occurance of a string within a String will return the number of occurances.

Strings may be extracted from Strings at, before, through, from and after a starting position within the String. Deletion of characters is possible after a given position within the String. Global substitution of characters within a String is provided, as well. Splitting of Strings into a carray of Strings is possible, based upon a given separator character, with a return value of the number of elements split. The joining together of the elements of an array of Strings into one String is possible.

Finally, transformations of case and conversions of type are provided.

The standard string class provides the following functionality:

  1. Construction from (part of) String, (part of) Char*, (repeating) Char, iterator pair.
  2. Assignment from String, Char*, Char
  3. Iterators: begin() and end(); rbegin() and rend() (Note: gcc reverse iterators still weak)
  4. Capacity: size, length, max_size, resize, capacity, reserve, clear, empty
  5. Special size: String::size_type, with indicator: String::npos
  6. Element access: [pos] and at(pos) (both const and non-const)
  7. Modifiers: += of String, Char*, Char; append of (part of) String, Char*, Char and iterator defined; assign() of (part of) String, Char* and (repeating) Char and iterator; insertion of same; replacing of same; erase of part of String; a copy and a swap.
  8. C-string: get Char* with c_str() or data() and get the relevant Allocator used (Note: not fully supported in gcc)
  9. Operations: find, rfind, find_first_of, find_last_of, find_first_not_of, find_last_not_of; substr (Note only readable substring); compare with (part of) String, Char*
  10. Globals: Addition operators for String, Char*, Char; all comparison operators for String and Char*; getline; input and output stream operators
  11. Typedef: All relevant typedefs for standard containers and iterator handling

The Casacore additions are:

  1. To standard: some Char function arguments where appropriate; Regex arguments in search like methods.
  2. Substring additions: at, before, after, from, through functions taking search String, Char* as arguments can give (hidden) substrings which can be assigned (as in at(1,2) = ";")
  3. Methods: prepend (in addition to standard append); del (as erase); global substitution of String and patterns; freq (count of occurance); split/join of strings at separator or pattern; upcase, downcase, reverse; common_suffix and _prefix; replicate; case insensitive compare; creation from stream

Example

// Let's start with a simple string.
String myString("the time");
// add some more on the end..\.
myString += " for all good men";
// prepend some on the front..\.
myString.prepend("Now is ");
// do some concatination..\.
String evenMore;
evenMore += myString + " to come to";
// do some three way concatination
String allKeys, finishIt(" their country.");
allKeys = evenMore + "the aid of" + finishIt;
// find the spot where we put something earlier
String::size_type position = allKeys.index(finishIt);
// find if the word is in the String..\.
Bool query = myString.contains("good men");
// ask if the position we think is true is correct..\.
Bool answer = allKeys.matches(finishIt, position);
// How many spaces are in our phrase?
Int spacesCount = allKeys.freq(" ");
string::size_type size_type
Definition: String.h:233
String()
Default constructor.
Definition: String.h:250
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42

Motivation

The String class eases the handling of characters within the Casacore environment.

To Do

Definition at line 225 of file String.h.

Member Typedef Documentation

◆ allocator_type

typedef string::allocator_type casacore::String::allocator_type

Definition at line 232 of file String.h.

◆ const_iterator

typedef string::const_iterator casacore::String::const_iterator

Definition at line 242 of file String.h.

◆ const_pointer

typedef string::const_pointer casacore::String::const_pointer

Definition at line 239 of file String.h.

◆ const_reference

typedef string::const_reference casacore::String::const_reference

Definition at line 237 of file String.h.

◆ const_reverse_iterator

typedef string::const_reverse_iterator casacore::String::const_reverse_iterator

Definition at line 244 of file String.h.

◆ difference_type

typedef string::difference_type casacore::String::difference_type

Definition at line 234 of file String.h.

◆ iterator

typedef string::iterator casacore::String::iterator

Definition at line 241 of file String.h.

◆ pointer

typedef string::pointer casacore::String::pointer

Definition at line 238 of file String.h.

◆ reference

typedef string::reference casacore::String::reference

Definition at line 236 of file String.h.

◆ reverse_iterator

typedef string::reverse_iterator casacore::String::reverse_iterator

Definition at line 243 of file String.h.

◆ size_type

typedef string::size_type casacore::String::size_type

Definition at line 233 of file String.h.

◆ traits_type

typedef string::traits_type casacore::String::traits_type

Definition at line 230 of file String.h.

◆ value_type

typedef string::value_type casacore::String::value_type

Definition at line 231 of file String.h.

Constructor & Destructor Documentation

◆ String() [1/9]

casacore::String::String ( )
inline

Default constructor.

Definition at line 250 of file String.h.

Referenced by at(), compare(), matches(), operator=(), and substr().

◆ String() [2/9]

casacore::String::String ( const string &  str,
size_type  pos = 0,
size_type  n = npos 
)
inline

Construct from std string Construct from (part of) other string: acts as copy constructor.

Thrown Exceptions

  • out_of_range if pos > str.size()

Definition at line 256 of file String.h.

◆ String() [3/9]

casacore::String::String ( const Char s,
size_type  n 
)
inline

Construct from char* with given length.

Thrown Exceptions

  • length_error if n == npos

Definition at line 262 of file String.h.

◆ String() [4/9]

casacore::String::String ( const Char s)
inline

Construct from char array.

Definition at line 264 of file String.h.

◆ String() [5/9]

casacore::String::String ( size_type  n,
Char  c 
)
inline

Construct from a single char (repeated n times)

Thrown Exceptions

  • length_error if n == npos

Definition at line 269 of file String.h.

◆ String() [6/9]

template<class InputIterator >
casacore::String::String ( InputIterator  begin,
InputIterator  end 
)
inline

Construct from iterator.

Definition at line 272 of file String.h.

◆ String() [7/9]

casacore::String::String ( Char  c)
inlineexplicit

From single char (** Casacore addition).


Warning: Note that there is no automatic Char-to-String conversion available; This stops inadvertent conversions of integer to string;

Definition at line 277 of file String.h.

◆ String() [8/9]

casacore::String::String ( const SubString str)
inline

Construct from a SubString.

Definition at line 279 of file String.h.

◆ String() [9/9]

casacore::String::String ( ostringstream &  os)

Construct from a stream.

◆ ~String()

casacore::String::~String ( )
inline

Destructor.

Definition at line 285 of file String.h.

Member Function Documentation

◆ _substr()

SubString casacore::String::_substr ( size_type  first,
size_type  l 
) const
inlineprivate

Helper functions for at, before etc.

Definition at line 882 of file String.h.

References first.

◆ after() [1/6]

SubString casacore::String::after ( Char  c,
size_type  startpos = 0 
)

◆ after() [2/6]

SubString casacore::String::after ( const Char s,
size_type  startpos = 0 
)

◆ after() [3/6]

SubString casacore::String::after ( const Regex r,
size_type  startpos = 0 
)

◆ after() [4/6]

SubString casacore::String::after ( const string &  str,
size_type  startpos = 0 
)

◆ after() [5/6]

SubString casacore::String::after ( Int  pos)
inline

Next one for overloading reasons.

Definition at line 839 of file String.h.

References after().

◆ after() [6/6]

SubString casacore::String::after ( size_type  pos)

Start at startpos and extract the SubString "after" the argument's position, exclusive, to the String's end.

** Casacore addition

Referenced by after().

◆ alloc()

void casacore::String::alloc ( size_type  n)
inline

** Casacore addition – works as a resize(n)

Definition at line 368 of file String.h.

◆ allocation()

Int casacore::String::allocation ( ) const
inline

** Casacore addition – works as a capacity(n) – Note Int

Definition at line 349 of file String.h.

◆ append() [1/7]

String& casacore::String::append ( Char  c)
inline

** Casacore addition

Definition at line 412 of file String.h.

References casacore::C::c.

◆ append() [2/7]

String& casacore::String::append ( const Char s)
inline

Definition at line 404 of file String.h.

◆ append() [3/7]

String& casacore::String::append ( const Char s,
size_type  n 
)
inline

Definition at line 402 of file String.h.

◆ append() [4/7]

String& casacore::String::append ( const string &  str)
inline

Append.

Thrown Exceptions

  • out_of_range if pos > str.size()
  • length_error if new size() >= npos


Warning: The standard has a void push_back(const Char) which is completely undefined; It probably is a remnant of the full list of container functions pop/push back/front;

Definition at line 398 of file String.h.

Referenced by casacore::String_global_functions_concatenator::operator+().

◆ append() [5/7]

String& casacore::String::append ( const string &  str,
size_type  pos,
size_type  n 
)
inline

Definition at line 400 of file String.h.

◆ append() [6/7]

template<class InputIterator >
String& casacore::String::append ( InputIterator  first,
InputIterator  last 
)
inline

Definition at line 409 of file String.h.

References first.

◆ append() [7/7]

String& casacore::String::append ( size_type  n,
Char  c 
)
inline

Definition at line 406 of file String.h.

References casacore::C::c.

◆ assign() [1/7]

String& casacore::String::assign ( Char  c)
inline

** Casacore addition

Definition at line 435 of file String.h.

References casacore::C::c.

◆ assign() [2/7]

String& casacore::String::assign ( const Char s)
inline

Definition at line 427 of file String.h.

◆ assign() [3/7]

String& casacore::String::assign ( const Char s,
size_type  n 
)
inline

Definition at line 425 of file String.h.

◆ assign() [4/7]

String& casacore::String::assign ( const string &  str)
inline

Assign.

Thrown Exceptions

  • out_of_range if pos > str.size()

Definition at line 421 of file String.h.

◆ assign() [5/7]

String& casacore::String::assign ( const string &  str,
size_type  pos,
size_type  n 
)
inline

Definition at line 423 of file String.h.

◆ assign() [6/7]

template<class InputIterator >
String& casacore::String::assign ( InputIterator  first,
InputIterator  last 
)
inline

Definition at line 432 of file String.h.

References first.

◆ assign() [7/7]

String& casacore::String::assign ( size_type  n,
Char  c 
)
inline

Definition at line 429 of file String.h.

References casacore::C::c.

◆ at() [1/16]

SubString casacore::String::at ( Char  c,
Int  startpos = 0 
)

◆ at() [2/16]

String casacore::String::at ( Char  c,
Int  startpos = 0 
) const

◆ at() [3/16]

SubString casacore::String::at ( const Char s,
Int  startpos = 0 
)

◆ at() [4/16]

String casacore::String::at ( const Char s,
Int  startpos = 0 
) const

◆ at() [5/16]

SubString casacore::String::at ( const Regex r,
Int  startpos = 0 
)

◆ at() [6/16]

String casacore::String::at ( const Regex r,
Int  startpos = 0 
) const

◆ at() [7/16]

SubString casacore::String::at ( const string &  str,
Int  startpos = 0 
)

◆ at() [8/16]

String casacore::String::at ( const string &  str,
Int  startpos = 0 
) const

◆ at() [9/16]

SubString casacore::String::at ( Int  pos,
Int  len 
)
inline

Next ones for overloading reasons.


Tip: It is better to use the substr() method in stead;

Definition at line 775 of file String.h.

References at().

◆ at() [10/16]

String casacore::String::at ( Int  pos,
Int  len 
) const
inline

Definition at line 778 of file String.h.

References at().

◆ at() [11/16]

SubString casacore::String::at ( Int  pos,
size_type  len 
)
inline

Definition at line 781 of file String.h.

References at().

◆ at() [12/16]

String casacore::String::at ( Int  pos,
size_type  len 
) const
inline

Definition at line 784 of file String.h.

References at().

◆ at() [13/16]

reference casacore::String::at ( size_type  n)
inline

Definition at line 385 of file String.h.

◆ at() [14/16]

const_reference casacore::String::at ( size_type  n) const
inline

Addressing.

Thrown Exceptions

  • out_of_range if pos >= size()

Definition at line 384 of file String.h.

Referenced by at(), firstchar(), lastchar(), and operator()().

◆ at() [15/16]

SubString casacore::String::at ( size_type  pos,
size_type  len 
)

Extract the string "at" the argument's position.

** Casacore addition

◆ at() [16/16]

String casacore::String::at ( size_type  pos,
size_type  len 
) const
inline

Definition at line 762 of file String.h.

References String().

◆ before() [1/6]

SubString casacore::String::before ( Char  c,
size_type  startpos = 0 
) const

◆ before() [2/6]

SubString casacore::String::before ( const Char s,
size_type  startpos = 0 
) const

◆ before() [3/6]

SubString casacore::String::before ( const Regex r,
size_type  startpos = 0 
) const

◆ before() [4/6]

SubString casacore::String::before ( const string &  str,
size_type  startpos = 0 
) const

◆ before() [5/6]

SubString casacore::String::before ( Int  pos) const
inline

Next one for overloading reasons.

Definition at line 799 of file String.h.

References before().

◆ before() [6/6]

SubString casacore::String::before ( size_type  pos) const

Start at startpos and extract the string "before" the argument's position, exclusive.

** Casacore addition

Referenced by before().

◆ begin() [1/2]

iterator casacore::String::begin ( )
inline

Iterators.

Definition at line 332 of file String.h.

Referenced by clear(), and insert().

◆ begin() [2/2]

const_iterator casacore::String::begin ( ) const
inline

Definition at line 333 of file String.h.

◆ c_str()

const Char* casacore::String::c_str ( ) const
inline

Get char array.

As a proper null terminated C-string

Definition at line 557 of file String.h.

Referenced by casacore::FITSExtInfo::get_keyword(), casacore::FunctionMarshallable::loadFuncType(), casacore::operator<<(), and casacore::AipsError::what().

◆ capacity()

size_type casacore::String::capacity ( ) const
inline

Definition at line 347 of file String.h.

◆ capitalize()

void casacore::String::capitalize ( )

internal transformation to capitalization of String.

◆ chars()

const Char* casacore::String::chars ( ) const
inline

** Casacore synonym

Definition at line 561 of file String.h.

Referenced by casacore::VariableArrayFITSFieldCopier< recordType, fitsType >::copyToFITS().

◆ clear()

void casacore::String::clear ( )
inline

Clear the string
Warning: clear() executed as erase() due to missing clear() in gcc

Definition at line 374 of file String.h.

References begin(), and end().

◆ compare() [1/5]

Int casacore::String::compare ( const Char s) const
inline

Definition at line 490 of file String.h.

◆ compare() [2/5]

Int casacore::String::compare ( const string &  str) const
inline

Compare.

Returns 0 if strings equal and of equal size; else positive if str larger or longer; else negative.
Warning: The gcc compiler does not have the proper standard compare functions; Hence they are locally implemented;

Definition at line 483 of file String.h.

Referenced by casacore::String_global_functions_comparitor::operator!=(), casacore::String_global_functions_comparitor::operator<(), casacore::String_global_functions_comparitor::operator<=(), casacore::String_global_functions_comparitor::operator==(), casacore::String_global_functions_comparitor::operator>(), and casacore::String_global_functions_comparitor::operator>=().

◆ compare() [3/5]

Int casacore::String::compare ( size_type  pos1,
size_type  n1,
const Char s,
size_type  n2 = npos 
) const
inline

Definition at line 492 of file String.h.

References String().

◆ compare() [4/5]

Int casacore::String::compare ( size_type  pos1,
size_type  n1,
const string &  str 
) const
inline

Definition at line 485 of file String.h.

References String().

◆ compare() [5/5]

Int casacore::String::compare ( size_type  pos1,
size_type  n1,
const string &  str,
size_type  pos2,
size_type  n2 
) const
inline

Definition at line 487 of file String.h.

References String().

◆ contains() [1/8]

Bool casacore::String::contains ( Char  c) const
inline

Containment.

** Casacore addition

Definition at line 700 of file String.h.

References casacore::C::c, find(), and npos.

◆ contains() [2/8]

Bool casacore::String::contains ( Char  c,
Int  pos 
) const
inline

Does the string starting at the given position contain the given substring? If the position is negative, it is counted from the end.

Casacore addition

Definition at line 1024 of file String.h.

References casacore::C::c, index(), and npos.

◆ contains() [3/8]

Bool casacore::String::contains ( const Char s) const
inline

Definition at line 704 of file String.h.

References find(), and npos.

◆ contains() [4/8]

Bool casacore::String::contains ( const Char s,
Int  pos 
) const
inline

Definition at line 1028 of file String.h.

References index(), and npos.

◆ contains() [5/8]

Bool casacore::String::contains ( const Regex r) const

◆ contains() [6/8]

Bool casacore::String::contains ( const Regex r,
Int  pos 
) const
inline

Definition at line 1030 of file String.h.

References index(), and npos.

◆ contains() [7/8]

Bool casacore::String::contains ( const string &  str) const
inline

Definition at line 702 of file String.h.

References find(), and npos.

◆ contains() [8/8]

Bool casacore::String::contains ( const string &  str,
Int  pos 
) const
inline

Definition at line 1026 of file String.h.

References index(), and npos.

◆ copy()

size_type casacore::String::copy ( Char s,
size_type  n,
size_type  pos = 0 
) const
inline

Copy.

Thrown Exceptions

  • out_of_range if pos > size()

Definition at line 548 of file String.h.

References casacore::copy().

◆ data()

const Char* casacore::String::data ( ) const
inline

As pointer to char array

Definition at line 559 of file String.h.

Referenced by casacore::LSQaips::getErrors(), and casacore::LSQaips::solve().

◆ del() [1/6]

void casacore::String::del ( Char  c,
size_type  startpos = 0 
)

◆ del() [2/6]

void casacore::String::del ( const Char s,
size_type  startpos = 0 
)

◆ del() [3/6]

void casacore::String::del ( const Regex r,
size_type  startpos = 0 
)

◆ del() [4/6]

void casacore::String::del ( const string &  str,
size_type  startpos = 0 
)

Delete the first occurrence of target after startpos.

** Casacore addition

◆ del() [5/6]

void casacore::String::del ( Int  pos,
Int  len 
)
inline

Overload problem.

Definition at line 866 of file String.h.

References del().

◆ del() [6/6]

void casacore::String::del ( size_type  pos,
size_type  len 
)

Delete len chars starting at pos.

** Casacore addition

Referenced by del().

◆ downcase()

void casacore::String::downcase ( )

internal transformation to lowercase of String

◆ elem()

const_reference casacore::String::elem ( size_type  pos) const
inline

*** Casacore addition

Definition at line 322 of file String.h.

◆ empty()

Bool casacore::String::empty ( ) const
inline

◆ end() [1/2]

iterator casacore::String::end ( )
inline

Definition at line 334 of file String.h.

Referenced by clear().

◆ end() [2/2]

const_iterator casacore::String::end ( ) const
inline

Definition at line 335 of file String.h.

◆ erase() [1/3]

iterator casacore::String::erase ( iterator  first,
iterator  last 
)
inline

Definition at line 503 of file String.h.

References first.

◆ erase() [2/3]

iterator casacore::String::erase ( iterator  position)
inline

Definition at line 501 of file String.h.

◆ erase() [3/3]

String& casacore::String::erase ( size_type  pos,
size_type  n = npos 
)
inline

Erase.

Definition at line 499 of file String.h.

◆ find() [1/5]

size_type casacore::String::find ( Char  c,
size_type  pos = 0 
) const
inline

Definition at line 652 of file String.h.

References casacore::C::c.

◆ find() [2/5]

size_type casacore::String::find ( const Char s,
size_type  pos,
size_type  n 
) const
inline

Definition at line 650 of file String.h.

◆ find() [3/5]

size_type casacore::String::find ( const Char s,
size_type  pos = 0 
) const
inline

Definition at line 648 of file String.h.

◆ find() [4/5]

size_type casacore::String::find ( const Regex r,
size_type  pos = 0 
) const

◆ find() [5/5]

size_type casacore::String::find ( const string &  str,
size_type  pos = 0 
) const
inline

Search functions.

Returns either npos (if not found); else position.
Warning: The Regex ones are ** Casacore additions

Definition at line 646 of file String.h.

Referenced by contains(), index(), and startsWith().

◆ find_first_not_of() [1/4]

size_type casacore::String::find_first_not_of ( Char  c,
size_type  pos = 0 
) const
inline

Definition at line 685 of file String.h.

References casacore::C::c.

◆ find_first_not_of() [2/4]

size_type casacore::String::find_first_not_of ( const Char s,
size_type  pos,
size_type  n 
) const
inline

Definition at line 683 of file String.h.

◆ find_first_not_of() [3/4]

size_type casacore::String::find_first_not_of ( const Char s,
size_type  pos = 0 
) const
inline

Definition at line 681 of file String.h.

◆ find_first_not_of() [4/4]

size_type casacore::String::find_first_not_of ( const string &  str,
size_type  pos = 0 
) const
inline

Definition at line 679 of file String.h.

◆ find_first_of() [1/4]

size_type casacore::String::find_first_of ( Char  c,
size_type  pos = 0 
) const
inline

Definition at line 669 of file String.h.

References casacore::C::c.

◆ find_first_of() [2/4]

size_type casacore::String::find_first_of ( const Char s,
size_type  pos,
size_type  n 
) const
inline

Definition at line 667 of file String.h.

◆ find_first_of() [3/4]

size_type casacore::String::find_first_of ( const Char s,
size_type  pos = 0 
) const
inline

Definition at line 665 of file String.h.

◆ find_first_of() [4/4]

size_type casacore::String::find_first_of ( const string &  str,
size_type  pos = 0 
) const
inline

Definition at line 663 of file String.h.

◆ find_last_not_of() [1/4]

size_type casacore::String::find_last_not_of ( Char  c,
size_type  pos = npos 
) const
inline

Definition at line 693 of file String.h.

References casacore::C::c.

◆ find_last_not_of() [2/4]

size_type casacore::String::find_last_not_of ( const Char s,
size_type  pos,
size_type  n 
) const
inline

Definition at line 691 of file String.h.

◆ find_last_not_of() [3/4]

size_type casacore::String::find_last_not_of ( const Char s,
size_type  pos = npos 
) const
inline

Definition at line 689 of file String.h.

◆ find_last_not_of() [4/4]

size_type casacore::String::find_last_not_of ( const string &  str,
size_type  pos = npos 
) const
inline

Definition at line 687 of file String.h.

◆ find_last_of() [1/4]

size_type casacore::String::find_last_of ( Char  c,
size_type  pos = npos 
) const
inline

Definition at line 677 of file String.h.

References casacore::C::c.

◆ find_last_of() [2/4]

size_type casacore::String::find_last_of ( const Char s,
size_type  pos,
size_type  n 
) const
inline

Definition at line 675 of file String.h.

◆ find_last_of() [3/4]

size_type casacore::String::find_last_of ( const Char s,
size_type  pos = npos 
) const
inline

Definition at line 673 of file String.h.

◆ find_last_of() [4/4]

size_type casacore::String::find_last_of ( const string &  str,
size_type  pos = npos 
) const
inline

Definition at line 671 of file String.h.

◆ firstchar()

Char casacore::String::firstchar ( ) const
inline

Definition at line 324 of file String.h.

References at().

◆ format()

static String casacore::String::format ( const char *  picture,
  ... 
)
static

Create a formatted string using the given printf format string.

◆ freq() [1/3]

Int casacore::String::freq ( Char  c) const

Return the number of occurences of target in String.

** Casacore addition

◆ freq() [2/3]

Int casacore::String::freq ( const Char s) const

◆ freq() [3/3]

Int casacore::String::freq ( const string &  str) const

◆ from() [1/6]

SubString casacore::String::from ( Char  c,
size_type  startpos = 0 
)

◆ from() [2/6]

SubString casacore::String::from ( const Char s,
size_type  startpos = 0 
)

◆ from() [3/6]

SubString casacore::String::from ( const Regex r,
size_type  startpos = 0 
)

◆ from() [4/6]

SubString casacore::String::from ( const string &  str,
size_type  startpos = 0 
)

◆ from() [5/6]

SubString casacore::String::from ( Int  pos)
inline

Next one for overloading reasons.

Definition at line 825 of file String.h.

References from().

◆ from() [6/6]

SubString casacore::String::from ( size_type  pos)

Start at startpos and extract the SubString "from" the argument's position, inclusive, to the String's end.

** Casacore addition

Referenced by from().

◆ fromString() [1/2]

template<typename T >
T casacore::String::fromString ( ) const
inline

Definition at line 595 of file String.h.

References casacore::value().

◆ fromString() [2/2]

template<typename T >
Bool casacore::String::fromString ( T &  value,
Bool  chk = True 
) const
inline

Convert a String to a value.

All characters in the string must be used. It uses a shift from an ostringstream, so that operator must exist for the data type used.
In case of an error, an exception is thrown if chk is set. Otherwise it returns False and value contains the value read so far.

Definition at line 585 of file String.h.

References casacore::False, throwFromStringError(), casacore::True, and casacore::value().

◆ get_allocator()

allocator_type casacore::String::get_allocator ( ) const
inline

Get allocator used
Warning: gcc has no get_allocator()

Definition at line 566 of file String.h.

◆ gsub() [1/4]

Int casacore::String::gsub ( const Char pat,
const Char repl 
)

◆ gsub() [2/4]

Int casacore::String::gsub ( const Char pat,
const string &  repl 
)

◆ gsub() [3/4]

Int casacore::String::gsub ( const Regex pat,
const string &  repl 
)

◆ gsub() [4/4]

Int casacore::String::gsub ( const string &  pat,
const string &  repl 
)

Global substitution: substitute all occurrences of pat with repl, and return the number of replacements.

Casacore addition

◆ index() [1/4]

size_type casacore::String::index ( Char  c,
Int  startpos = 0 
) const
inline

Return the position of the target in the string or npos for failure.

Casacore addition

Definition at line 740 of file String.h.

References casacore::C::c, find(), length(), and rfind().

Referenced by contains().

◆ index() [2/4]

size_type casacore::String::index ( const Char s,
Int  startpos = 0 
) const
inline

Definition at line 746 of file String.h.

References find(), length(), casacore::length(), and rfind().

◆ index() [3/4]

size_type casacore::String::index ( const Regex r,
Int  startpos = 0 
) const

◆ index() [4/4]

size_type casacore::String::index ( const string &  str,
Int  startpos = 0 
) const
inline

Definition at line 743 of file String.h.

References find(), length(), and rfind().

◆ insert() [1/12]

iterator casacore::String::insert ( iterator  p,
Char  c 
)
inline

Definition at line 460 of file String.h.

References casacore::C::c.

◆ insert() [2/12]

String& casacore::String::insert ( iterator  p,
const Char s 
)
inline

Definition at line 473 of file String.h.

References begin().

◆ insert() [3/12]

String& casacore::String::insert ( iterator  p,
const Char s,
size_type  n 
)
inline

Definition at line 471 of file String.h.

References begin().

◆ insert() [4/12]

String& casacore::String::insert ( iterator  p,
const string &  str 
)
inline

** Casacore additions

Definition at line 469 of file String.h.

References begin().

◆ insert() [5/12]

template<class InputIterator >
void casacore::String::insert ( iterator  p,
InputIterator  first,
InputIterator  last 
)
inline

Definition at line 465 of file String.h.

References first.

◆ insert() [6/12]

void casacore::String::insert ( iterator  p,
size_type  n,
Char  c 
)
inline

Definition at line 462 of file String.h.

References casacore::C::c.

◆ insert() [7/12]

String& casacore::String::insert ( size_type  pos,
Char  c 
)
inline

** Casacore addition

Definition at line 457 of file String.h.

References casacore::C::c.

◆ insert() [8/12]

String& casacore::String::insert ( size_type  pos,
const Char s 
)
inline

Definition at line 452 of file String.h.

◆ insert() [9/12]

String& casacore::String::insert ( size_type  pos,
const Char s,
size_type  n 
)
inline

Definition at line 450 of file String.h.

◆ insert() [10/12]

String& casacore::String::insert ( size_type  pos,
size_type  n,
Char  c 
)
inline

Definition at line 454 of file String.h.

References casacore::C::c.

◆ insert() [11/12]

String& casacore::String::insert ( size_type  pos1,
const string &  str 
)
inline

Insert.

Thrown Exceptions

  • out_of_range if pos1 > str.size() or pos2 > str.size()
  • length_error if new size() >= npos

Definition at line 445 of file String.h.

◆ insert() [12/12]

String& casacore::String::insert ( size_type  pos1,
const string &  str,
size_type  pos2,
size_type  n 
)
inline

Definition at line 447 of file String.h.

◆ lastchar()

Char casacore::String::lastchar ( ) const
inline

Definition at line 325 of file String.h.

References at(), and length().

◆ length()

size_type casacore::String::length ( ) const
inline

◆ ltrim()

void casacore::String::ltrim ( char  c)

Remove specified character from beginning of string.

If the character is repeated more than once on the left, all instances will be removed; e.g. ltrim(',') results in ",,xy" becoming "xy".

◆ matches() [1/4]

Bool casacore::String::matches ( Char  c,
Int  pos = 0 
) const
inline

Definition at line 723 of file String.h.

References casacore::C::c, matches(), and String().

◆ matches() [2/4]

Bool casacore::String::matches ( const Char s,
Int  pos = 0 
) const
inline

Definition at line 725 of file String.h.

References matches(), and String().

◆ matches() [3/4]

Bool casacore::String::matches ( const Regex r,
Int  pos = 0 
) const

◆ matches() [4/4]

Bool casacore::String::matches ( const string &  str,
Int  pos = 0 
) const

Matches entire string from pos (or till pos if negative pos).

** Casacore addition

Referenced by casacore::TaqlRegex::match(), and matches().

◆ max_size()

size_type casacore::String::max_size ( ) const
inline

Definition at line 346 of file String.h.

◆ operator()()

SubString casacore::String::operator() ( size_type  pos,
size_type  len 
)
inline

Casacore addition: synonym for at(pos, len)

Definition at line 1020 of file String.h.

References at().

◆ operator+=() [1/3]

String& casacore::String::operator+= ( Char  c)
inline

Definition at line 307 of file String.h.

References casacore::C::c.

◆ operator+=() [2/3]

String& casacore::String::operator+= ( const Char s)
inline

Definition at line 305 of file String.h.

◆ operator+=() [3/3]

String& casacore::String::operator+= ( const string &  str)
inline

Concatenate.

Definition at line 303 of file String.h.

◆ operator=() [1/4]

String& casacore::String::operator= ( Char  c)
inline

Definition at line 296 of file String.h.

References casacore::C::c, and casacore::operator=().

◆ operator=() [2/4]

String& casacore::String::operator= ( const Char s)
inline

Definition at line 294 of file String.h.

References casacore::operator=().

◆ operator=() [3/4]

String& casacore::String::operator= ( const string &  str)
inline

Assignments (they are all deep copies according to standard)

Definition at line 290 of file String.h.

References casacore::operator=().

◆ operator=() [4/4]

String& casacore::String::operator= ( const SubString str)
inline

Definition at line 292 of file String.h.

References String().

◆ operator[]() [1/2]

reference casacore::String::operator[] ( size_type  pos)
inline

Definition at line 318 of file String.h.

◆ operator[]() [2/2]

const_reference casacore::String::operator[] ( size_type  pos) const
inline

Indexing.

The standard version is undefined if pos > size(), or pos >= size() for non-const version.
Warning: The const_reference version needs the at() version for the gcc compiler: no const [] exists;

Definition at line 316 of file String.h.

◆ prepend() [1/3]

void casacore::String::prepend ( Char  c)

◆ prepend() [2/3]

void casacore::String::prepend ( const Char s)

◆ prepend() [3/3]

void casacore::String::prepend ( const string &  str)

Concatenate by prepending the argument onto String.

** Casacore addition

◆ rbegin() [1/2]

reverse_iterator casacore::String::rbegin ( )
inline

Definition at line 336 of file String.h.

◆ rbegin() [2/2]

const_reverse_iterator casacore::String::rbegin ( ) const
inline

Definition at line 337 of file String.h.

◆ rend() [1/2]

reverse_iterator casacore::String::rend ( )
inline

Definition at line 338 of file String.h.

◆ rend() [2/2]

const_reverse_iterator casacore::String::rend ( ) const
inline

Definition at line 339 of file String.h.

◆ replace() [1/12]

String& casacore::String::replace ( iterator  i1,
iterator  i2,
Char  c 
)
inline

** Casacore addition

Definition at line 536 of file String.h.

References casacore::C::c, and casacore::replace().

◆ replace() [2/12]

String& casacore::String::replace ( iterator  i1,
iterator  i2,
const Char s 
)
inline

Definition at line 531 of file String.h.

References casacore::replace().

◆ replace() [3/12]

String& casacore::String::replace ( iterator  i1,
iterator  i2,
const Char s,
size_type  n 
)
inline

Definition at line 529 of file String.h.

References casacore::replace().

◆ replace() [4/12]

String& casacore::String::replace ( iterator  i1,
iterator  i2,
const string &  str 
)
inline

Definition at line 527 of file String.h.

References casacore::replace().

◆ replace() [5/12]

template<class InputIterator >
String& casacore::String::replace ( iterator  i1,
iterator  i2,
InputIterator  j1,
InputIterator  j2 
)
inline

Definition at line 539 of file String.h.

References casacore::replace().

◆ replace() [6/12]

String& casacore::String::replace ( iterator  i1,
iterator  i2,
size_type  n,
Char  c 
)
inline

Definition at line 533 of file String.h.

References casacore::C::c, and casacore::replace().

◆ replace() [7/12]

String& casacore::String::replace ( size_type  pos,
size_type  n1,
Char  c 
)
inline

** Casacore addition

Definition at line 525 of file String.h.

References casacore::C::c, and casacore::replace().

◆ replace() [8/12]

String& casacore::String::replace ( size_type  pos,
size_type  n1,
const Char s 
)
inline

Definition at line 520 of file String.h.

References casacore::replace().

◆ replace() [9/12]

String& casacore::String::replace ( size_type  pos,
size_type  n1,
const Char s,
size_type  n2 
)
inline

Definition at line 518 of file String.h.

References casacore::replace().

◆ replace() [10/12]

String& casacore::String::replace ( size_type  pos,
size_type  n1,
size_type  n2,
Char  c 
)
inline

Definition at line 522 of file String.h.

References casacore::C::c, and casacore::replace().

◆ replace() [11/12]

String& casacore::String::replace ( size_type  pos1,
size_type  n1,
const string &  str 
)
inline

Replace.

Thrown Exceptions

  • out_of_range if pos1 > str.size() or pos2 > str.size()
  • length_error if new size() > npos

Definition at line 513 of file String.h.

References casacore::replace().

◆ replace() [12/12]

String& casacore::String::replace ( size_type  pos1,
size_type  n1,
const string &  str,
size_type  pos2,
size_type  n2 
)
inline

Definition at line 515 of file String.h.

References casacore::replace().

◆ reserve()

String& casacore::String::reserve ( size_type  res_arg = 0)
inline

Definition at line 365 of file String.h.

◆ resize() [1/2]

String& casacore::String::resize ( size_type  n)
inline

Resize by truncating or extending with copies of c (default Char())

Thrown Exceptions


Tip: The reserve length given is non-binding on the implementation

Definition at line 361 of file String.h.

Referenced by casacore::LSQaips::getErrors(), and casacore::LSQaips::solve().

◆ resize() [2/2]

String& casacore::String::resize ( size_type  n,
Char  c 
)
inline

Definition at line 363 of file String.h.

References casacore::C::c.

◆ reverse()

void casacore::String::reverse ( )

Maybe forget some.

** Casacore addition

internal transformation to reverse order of String.

◆ rfind() [1/4]

size_type casacore::String::rfind ( Char  c,
size_type  pos = npos 
) const
inline

Definition at line 661 of file String.h.

References casacore::C::c.

◆ rfind() [2/4]

size_type casacore::String::rfind ( const Char s,
size_type  pos,
size_type  n 
) const
inline

Definition at line 659 of file String.h.

◆ rfind() [3/4]

size_type casacore::String::rfind ( const Char s,
size_type  pos = npos 
) const
inline

Definition at line 657 of file String.h.

◆ rfind() [4/4]

size_type casacore::String::rfind ( const string &  str,
size_type  pos = npos 
) const
inline

Definition at line 655 of file String.h.

Referenced by index().

◆ rtrim()

void casacore::String::rtrim ( char  c)

Remove specified character from end of string.

If the character is repeated more than once on the right, all instances will be removed; e.g. rtrim(',') results in "xy,," becoming "xy".

◆ size()

size_type casacore::String::size ( ) const
inline

Capacity, size.

Definition at line 344 of file String.h.

◆ startsWith()

Bool casacore::String::startsWith ( const string &  beginString) const
inline

Does the string start with the specified string?

Definition at line 640 of file String.h.

References find().

◆ substr()

String casacore::String::substr ( size_type  pos = 0,
size_type  n = npos 
) const
inline

Get a sub string.

Thrown Exceptions

  • out_of_range if pos > size()

Definition at line 572 of file String.h.

References String().

◆ swap()

void casacore::String::swap ( string &  s)
inline

Swap.

Definition at line 552 of file String.h.

References casacore::swap().

◆ through() [1/6]

SubString casacore::String::through ( Char  c,
size_type  startpos = 0 
)

◆ through() [2/6]

SubString casacore::String::through ( const Char s,
size_type  startpos = 0 
)

◆ through() [3/6]

SubString casacore::String::through ( const Regex r,
size_type  startpos = 0 
)

◆ through() [4/6]

SubString casacore::String::through ( const string &  str,
size_type  startpos = 0 
)

◆ through() [5/6]

SubString casacore::String::through ( Int  pos)
inline

Next one for overloading reasons.

Definition at line 812 of file String.h.

References through().

◆ through() [6/6]

SubString casacore::String::through ( size_type  pos)

Start at startpos and extract the SubString "through" to the argument's position, inclusive.

** Casacore addition

Referenced by through().

◆ throwFromStringError()

void casacore::String::throwFromStringError ( ) const
private

Helper function for fromString.

Referenced by fromString().

◆ toDouble()

static Double casacore::String::toDouble ( const String s,
Bool  chk = False 
)
static

◆ toFloat()

static Float casacore::String::toFloat ( const String s,
Bool  chk = False 
)
static

◆ toInt()

static Int casacore::String::toInt ( const String s,
Bool  chk = False 
)
static

Convert a string to an Int, Float or Double.


In case of an error, an exception is thrown if chk is set. Otherwise the value read so far is returned (0 if nothing read).

◆ toString()

template<typename T >
static String casacore::String::toString ( const T &  value)
inlinestatic

Convert a value to a String.

It uses a shift into an ostringstream, so that operator must be defined for the data type used.

Definition at line 616 of file String.h.

References casacore::value().

◆ trim() [1/2]

void casacore::String::trim ( )

Remove beginning and ending whitespace.

◆ trim() [2/2]

void casacore::String::trim ( char  c[],
uInt  n 
)

Remove specified chars from beginning and end of string.

◆ upcase()

void casacore::String::upcase ( )

internal transformation to uppercase of String

Member Data Documentation

◆ npos

const size_type casacore::String::npos
static

Definition at line 246 of file String.h.

Referenced by contains().


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