Loading...
Searching...
No Matches
casacore::String Class Reference
casa package (libcasa_casa) » BasicSL_module

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.
| 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.
| String (const Char *s, size_type n)
| Construct from char* with given length.
| String (const Char *s)
| Construct from char array.
| String (size_type n, Char c)
| Construct from a single char (repeated n times).
template<class InputIterator>
| String (InputIterator begin, InputIterator end)
| Construct from iterator.
| String (Char c)
| From single char (** Casacore addition).
| String (const SubString &str)
| Construct from a SubString.
| String (ostringstream &os)
| Construct from a stream.
| ~String ()
| Destructor.
String & | operator= (const string &str)
| Assignments (they are all deep copies according to standard).
String & | operator= (const SubString &str)
String & | operator= (const Char *s)
String & | operator= (Char c)
SubString | operator() (size_type pos, size_type len)
| Casacore addition: synonym for at(pos, len).
String & | operator+= (const string &str)
| Concatenate.
String & | operator+= (const Char *s)
String & | operator+= (Char c)
const_reference | operator[] (size_type pos) const
| Indexing.
reference | operator[] (size_type pos)
const_reference | elem (size_type pos) const
| *** Casacore addition
Char | firstchar () const
Char | lastchar () const
iterator | begin ()
| Iterators.
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.
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
String & | resize (size_type n)
| Resize by truncating or extending with copies of c (default Char()).
String & | resize (size_type n, Char c)
String & | reserve (size_type res_arg=0)
void | alloc (size_type n)
| ** Casacore addition – works as a resize(n)
void | clear ()
| Clear the string Warning: clear() executed as erase() due to missing clear() in gcc .
Bool | empty () const
| Test for empty.
const_reference | at (size_type n) const
| Addressing.
reference | at (size_type n)
String & | append (const string &str)
| Append.
String & | append (const string &str, size_type pos, size_type n)
String & | append (const Char *s, size_type n)
String & | append (const Char *s)
String & | append (size_type n, Char c)
template<class InputIterator>
String & | append (InputIterator first, InputIterator last)
String & | append (Char c)
| ** Casacore addition
String & | assign (const string &str)
| Assign.
String & | assign (const string &str, size_type pos, size_type n)
String & | assign (const Char *s, size_type n)
String & | assign (const Char *s)
String & | assign (size_type n, Char c)
template<class InputIterator>
String & | assign (InputIterator first, InputIterator last)
String & | assign (Char c)
| ** Casacore addition
String & | insert (size_type pos1, const string &str)
| Insert.
String & | insert (size_type pos1, const string &str, size_type pos2, size_type n)
String & | insert (size_type pos, const Char *s, size_type n)
String & | insert (size_type pos, const Char *s)
String & | insert (size_type pos, size_type n, Char c)
String & | insert (size_type pos, Char c)
| ** Casacore addition
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)
String & | insert (iterator p, const string &str)
| ** Casacore additions
String & | insert (iterator p, const Char *s, size_type n)
String & | insert (iterator p, const Char *s)
Int | compare (const string &str) const
| Compare.
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
String & | erase (size_type pos, size_type n=npos)
| Erase.
iterator | erase (iterator position)
iterator | erase (iterator first, iterator last)
String & | replace (size_type pos1, size_type n1, const string &str)
| Replace.
String & | replace (size_type pos1, size_type n1, const string &str, size_type pos2, size_type n2)
String & | replace (size_type pos, size_type n1, const Char *s, size_type n2)
String & | replace (size_type pos, size_type n1, const Char *s)
String & | replace (size_type pos, size_type n1, size_type n2, Char c)
String & | replace (size_type pos, size_type n1, Char c)
| ** Casacore addition
String & | replace (iterator i1, iterator i2, const string &str)
String & | replace (iterator i1, iterator i2, const Char *s, size_type n)
String & | replace (iterator i1, iterator i2, const Char *s)
String & | replace (iterator i1, iterator i2, size_type n, Char c)
String & | replace (iterator i1, iterator i2, Char c)
| ** Casacore addition
template<class InputIterator>
String & | replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)
size_type | copy (Char *s, size_type n, size_type pos=0) const
| Copy.
void | swap (string &s)
| Swap.
const Char * | c_str () const
| Get char array.
const Char * | data () const
| As pointer to char array.
const Char * | chars () const
| ** Casacore synonym
allocator_type | get_allocator () const
| Get allocator used Warning: gcc has no get_allocator() .
String | substr (size_type pos=0, size_type n=npos) const
| Get a sub string.
template<typename T>
Bool | fromString (T &value, Bool chk=True) const
| Convert a String to a value.
template<typename T>
T | fromString () const
void | trim ()
| Remove beginning and ending whitespace.
void | trim (char c[], uInt n)
| Remove specified chars from beginning and end of string.
void | ltrim (char c)
| Remove specified character from beginning of string.
void | rtrim (char c)
| Remove specified character from end of string.
Bool | startsWith (const string &beginString) const
| Does the string start with the specified string?
size_type | find (const string &str, size_type pos=0) const
| Search functions.
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.
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?
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).
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.
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.
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.
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.
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.
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.
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.
SubString | through (size_type pos)
| Start at startpos and extract the SubString "through" to the argument's position, inclusive.
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.
SubString | from (size_type pos)
| Start at startpos and extract the SubString "from" the argument's position, inclusive, to the String's end.
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.
SubString | after (size_type pos)
| Start at startpos and extract the SubString "after" the argument's position, exclusive, to the String's end.
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.
void | reverse ()
| Maybe forget some.
void | capitalize ()
| internal transformation to capitalization of String.
void | upcase ()
| internal transformation to uppercase of String
void | downcase ()
| internal transformation to lowercase of String
void | del (size_type pos, size_type len)
| Delete len chars starting at pos.
void | del (const string &str, size_type startpos=0)
| Delete the first occurrence of target after startpos.
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.
Int | gsub (const string &pat, const string &repl)
| Global substitution: substitute all occurrences of pat with repl, and return the number of replacements.
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.
static Int | toInt (const String &s, Bool chk=False)
| Convert a string to an Int, Float or Double.
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.

## 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.
void | throwFromStringError () const
| Helper function for fromString.

## 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

- Regex - the regular expressions class
- the std string class

### 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(" ");
casacore::String::matches
Bool matches(const string &str, Int pos=0) const
Matches entire string from pos (or till pos if negative pos).
casacore::String::freq
Int freq(Char c) const
Return the number of occurences of target in String.
casacore::String::size_type
string::size_type size_type
Definition String.h:231
casacore::String::index
size_type index(Char c, Int startpos=0) const
Return the position of the target in the string or npos for failure.
Definition String.h:738
casacore::String::String
String()
Default constructor.
Definition String.h:248
casacore::Int
int Int
Definition aipstype.h:48
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40

### Motivation

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

### To Do

- if old string disappeared; remove the alloc() call.
- add more tests (for string methods) when old String disappears

Definition at line 223 of file String.h.

## Member Typedef Documentation

## allocator_type

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

Definition at line 230 of file String.h.

## const_iterator

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

Definition at line 240 of file String.h.

## const_pointer

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

Definition at line 237 of file String.h.

## const_reference

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

Definition at line 235 of file String.h.

## const_reverse_iterator

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

Definition at line 242 of file String.h.

## difference_type

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

Definition at line 232 of file String.h.

## iterator

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

Definition at line 239 of file String.h.

## pointer

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

Definition at line 236 of file String.h.

## reference

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

Definition at line 234 of file String.h.

## reverse_iterator

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

Definition at line 241 of file String.h.

## size_type

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

Definition at line 231 of file String.h.

## traits_type

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

Definition at line 228 of file String.h.

## value_type

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

Definition at line 229 of file String.h.

## Constructor & Destructor Documentation

## String() [1/9]

casacore::String::String | ( |  | ) |

inline

Default constructor.

Definition at line 248 of file String.h.

Referenced by append(), append(), append(), append(), append(), append(), append(), assign(), assign(), assign(), assign(), assign(), assign(), assign(), at(), at(), at(), at(), at(), at(), at(), compare(), compare(), compare(), erase(), format(), insert(), insert(), insert(), insert(), insert(), insert(), insert(), insert(), insert(), matches(), matches(), operator+=(), operator+=(), operator+=(), operator=(), operator=(), operator=(), operator=(), replace(), replace(), replace(), replace(), replace(), replace(), replace(), replace(), replace(), replace(), replace(), replace(), reserve(), resize(), resize(), substr(), toDouble(), toFloat(), toInt(), and toString().

## 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 254 of file String.h.

References npos.

## 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 260 of file String.h.

## String() [4/9]

casacore::String::String | ( | const Char * | s | ) |

inline

Construct from char array.

Definition at line 262 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 267 of file String.h.

## String() [6/9]

template<class InputIterator>

casacore::String::String | ( | InputIterator | begin,
|  | InputIterator | end )

inline

Construct from iterator.

Definition at line 270 of file String.h.

References begin(), and end().

## String() [7/9]

casacore::String::String | ( | Char | c | ) |

inline explicit

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 275 of file String.h.

## String() [8/9]

casacore::String::String | ( | const SubString & | str | ) |

inline

Construct from a SubString.

Definition at line 277 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 283 of file String.h.

## Member Function Documentation

## _substr()

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

inline private

Helper functions for at, before etc.

Definition at line 880 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 837 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 366 of file String.h.

## allocation()

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

inline

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

Definition at line 347 of file String.h.

## append() [1/7]

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

inline

** Casacore addition

Definition at line 410 of file String.h.

References String().

## append() [2/7]

String & casacore::String::append | ( | const Char * | s | ) |

inline

Definition at line 402 of file String.h.

References String().

## append() [3/7]

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

inline

Definition at line 400 of file String.h.

References String().

## 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 396 of file String.h.

References String().

Referenced by casacore::String_global_functions_concatenator::operator+(), casacore::String_global_functions_concatenator::operator+(), casacore::String_global_functions_concatenator::operator+(), casacore::String_global_functions_concatenator::operator+(), and 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 398 of file String.h.

References String().

## append() [6/7]

template<class InputIterator>

String & casacore::String::append | ( | InputIterator | first,
|  | InputIterator | last )

inline

Definition at line 407 of file String.h.

References first, and String().

## append() [7/7]

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

inline

Definition at line 404 of file String.h.

References String().

## assign() [1/7]

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

inline

** Casacore addition

Definition at line 433 of file String.h.

References String().

## assign() [2/7]

String & casacore::String::assign | ( | const Char * | s | ) |

inline

Definition at line 425 of file String.h.

References String().

## assign() [3/7]

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

inline

Definition at line 423 of file String.h.

References String().

## assign() [4/7]

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

inline

Assign.

### Thrown Exceptions

- out_of_range if pos > str.size()

Definition at line 419 of file String.h.

References String().

## assign() [5/7]

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

inline

Definition at line 421 of file String.h.

References String().

## assign() [6/7]

template<class InputIterator>

String & casacore::String::assign | ( | InputIterator | first,
|  | InputIterator | last )

inline

Definition at line 430 of file String.h.

References first, and String().

## assign() [7/7]

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

inline

Definition at line 427 of file String.h.

References String().

## 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

References String().

## 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

References String().

## 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

References String().

## 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

References String().

## 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 773 of file String.h.

References at().

## at() [10/16]

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

inline

Definition at line 776 of file String.h.

References at(), and String().

## at() [11/16]

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

inline

Definition at line 779 of file String.h.

References at().

## at() [12/16]

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

inline

Definition at line 782 of file String.h.

References at(), and String().

## at() [13/16]

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

inline

Definition at line 383 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 382 of file String.h.

Referenced by at(), at(), at(), 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 760 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 797 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 330 of file String.h.

Referenced by clear(), insert(), insert(), insert(), and String().

## begin() [2/2]

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

inline

Definition at line 331 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 555 of file String.h.

Referenced by casacore::FITSExtInfo::get_keyword(), and casacore::operator<<().

## capacity()

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

inline

Definition at line 345 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 559 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 372 of file String.h.

References begin(), and end().

## compare() [1/5]

Int casacore::String::compare | ( | const Char * | s | ) | const

inline

Definition at line 488 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 481 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<(), 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==(), 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>(), 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 490 of file String.h.

References npos, and String().

## compare() [4/5]

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

inline

Definition at line 483 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 485 of file String.h.

References String().

## contains() [1/8]

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

inline

Containment.

** Casacore addition

Definition at line 698 of file String.h.

References 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 1022 of file String.h.

References index(), and npos.

## contains() [3/8]

Bool casacore::String::contains | ( | const Char * | s | ) | const

inline

Definition at line 702 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 1026 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 1028 of file String.h.

References index(), and npos.

## contains() [7/8]

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

inline

Definition at line 700 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 1024 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 546 of file String.h.

## data()

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

inline

As pointer to char array.

Definition at line 557 of file String.h.

## 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 864 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 320 of file String.h.

## empty()

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

inline

Test for empty.

Definition at line 375 of file String.h.

Referenced by casacore::TableParsePair::test().

## end() [1/2]

iterator casacore::String::end | ( |  | ) |

inline

Definition at line 332 of file String.h.

Referenced by clear(), and String().

## end() [2/2]

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

inline

Definition at line 333 of file String.h.

## erase() [1/3]

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

inline

Definition at line 501 of file String.h.

References first.

## erase() [2/3]

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

inline

Definition at line 499 of file String.h.

## erase() [3/3]

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

inline

Erase.

Definition at line 497 of file String.h.

References npos, and String().

## find() [1/5]

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

inline

Definition at line 650 of file String.h.

## find() [2/5]

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

inline

Definition at line 648 of file String.h.

## find() [3/5]

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

inline

Definition at line 646 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 644 of file String.h.

Referenced by contains(), contains(), contains(), index(), index(), 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 683 of file String.h.

## 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 681 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 679 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 677 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 667 of file String.h.

## 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 665 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 663 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 661 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 691 of file String.h.

References npos.

## 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 689 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 687 of file String.h.

References npos.

## 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 685 of file String.h.

References npos.

## find_last_of() [1/4]

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

inline

Definition at line 675 of file String.h.

References npos.

## 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 673 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 671 of file String.h.

References npos.

## find_last_of() [4/4]

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

inline

Definition at line 669 of file String.h.

References npos.

## firstchar()

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

inline

Definition at line 322 of file String.h.

References at().

## format()

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

static

Create a formatted string using the given printf format string.

References 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 823 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 593 of file String.h.

References fromString(), and casacore::NewDelAllocator< T >::value.

Referenced by fromString().

## 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 583 of file String.h.

References casacore::False, casacore::NewDelAllocator< T >::value, throwFromStringError(), and casacore::True.

## get_allocator()

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

inline

Get allocator used
Warning: gcc has no get_allocator()
.

Definition at line 564 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 738 of file String.h.

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

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

## index() [2/4]

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

inline

Definition at line 744 of file String.h.

References find(), 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 741 of file String.h.

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

## insert() [1/12]

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

inline

Definition at line 458 of file String.h.

## insert() [2/12]

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

inline

Definition at line 471 of file String.h.

References begin(), and String().

## insert() [3/12]

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

inline

Definition at line 469 of file String.h.

References begin(), and String().

## insert() [4/12]

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

inline

** Casacore additions

Definition at line 467 of file String.h.

References begin(), and String().

## insert() [5/12]

template<class InputIterator>

void casacore::String::insert | ( | iterator | p,
|  | InputIterator | first,
|  | InputIterator | last )

inline

Definition at line 463 of file String.h.

References first.

## insert() [6/12]

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

inline

Definition at line 460 of file String.h.

## insert() [7/12]

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

inline

** Casacore addition

Definition at line 455 of file String.h.

References String().

## insert() [8/12]

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

inline

Definition at line 450 of file String.h.

References String().

## insert() [9/12]

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

inline

Definition at line 448 of file String.h.

References String().

## insert() [10/12]

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

inline

Definition at line 452 of file String.h.

References String().

## 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 443 of file String.h.

References String().

## insert() [12/12]

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

inline

Definition at line 445 of file String.h.

References String().

## lastchar()

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

inline

Definition at line 323 of file String.h.

References at(), and length().

## length()

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

inline

Definition at line 343 of file String.h.

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

## 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 721 of file String.h.

References matches(), and String().

## matches() [2/4]

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

inline

Definition at line 723 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(), matches(), and matches().

## max_size()

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

inline

Definition at line 344 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 1018 of file String.h.

References at().

## operator+=() [1/3]

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

inline

Definition at line 305 of file String.h.

References String().

## operator+=() [2/3]

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

inline

Definition at line 303 of file String.h.

References String().

## operator+=() [3/3]

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

inline

Concatenate.

Definition at line 301 of file String.h.

References String().

## operator=() [1/4]

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

inline

Definition at line 294 of file String.h.

References String().

## operator=() [2/4]

String & casacore::String::operator= | ( | const Char * | s | ) |

inline

Definition at line 292 of file String.h.

References String().

## operator=() [3/4]

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

inline

Assignments (they are all deep copies according to standard).

Definition at line 288 of file String.h.

References String().

## operator=() [4/4]

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

inline

Definition at line 290 of file String.h.

References String().

## operator[]() [1/2]

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

inline

Definition at line 316 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 314 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 334 of file String.h.

## rbegin() [2/2]

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

inline

Definition at line 335 of file String.h.

## rend() [1/2]

reverse_iterator casacore::String::rend | ( |  | ) |

inline

Definition at line 336 of file String.h.

## rend() [2/2]

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

inline

Definition at line 337 of file String.h.

## replace() [1/12]

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

inline

** Casacore addition

Definition at line 534 of file String.h.

References String().

## replace() [2/12]

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

inline

Definition at line 529 of file String.h.

References String().

## replace() [3/12]

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

inline

Definition at line 527 of file String.h.

References String().

## replace() [4/12]

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

inline

Definition at line 525 of file String.h.

References String().

## replace() [5/12]

template<class InputIterator>

String & casacore::String::replace | ( | iterator | i1,
|  | iterator | i2,
|  | InputIterator | j1,
|  | InputIterator | j2 )

inline

Definition at line 537 of file String.h.

References String().

## replace() [6/12]

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

inline

Definition at line 531 of file String.h.

References String().

## replace() [7/12]

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

inline

** Casacore addition

Definition at line 523 of file String.h.

References String().

## replace() [8/12]

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

inline

Definition at line 518 of file String.h.

References String().

## replace() [9/12]

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

inline

Definition at line 516 of file String.h.

References String().

## replace() [10/12]

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

inline

Definition at line 520 of file String.h.

References String().

## 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 511 of file String.h.

References String().

## 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 513 of file String.h.

References String().

## reserve()

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

inline

Definition at line 363 of file String.h.

References String().

## resize() [1/2]

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

inline

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

### Thrown Exceptions

- length_error if n > max_size()
- length_error if res_arg > max_size()

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

Definition at line 359 of file String.h.

References String().

## resize() [2/2]

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

inline

Definition at line 361 of file String.h.

References String().

## 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 659 of file String.h.

References npos.

## rfind() [2/4]

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

inline

Definition at line 657 of file String.h.

## rfind() [3/4]

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

inline

Definition at line 655 of file String.h.

References npos.

## rfind() [4/4]

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

inline

Definition at line 653 of file String.h.

References npos.

Referenced by index(), index(), and 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 342 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 638 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 570 of file String.h.

References npos, and String().

## swap()

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

inline

Swap.

Definition at line 550 of file String.h.

## 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 810 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()

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

static

References casacore::False, and String().

## toFloat()

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

static

References casacore::False, and String().

## toInt()

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).

References casacore::False, and String().

## toString()

template<typename T>

String casacore::String::toString | ( | const T & | value | ) |

inline static

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 614 of file String.h.

References casacore::NewDelAllocator< T >::value, and String().

Referenced by casacore::MrsEligibility::allButTheseSubtables(), and casacore::MrsEligibility::eligibleSubtables().

## 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 244 of file String.h.

Referenced by compare(), contains(), contains(), contains(), contains(), contains(), contains(), contains(), erase(), find_last_not_of(), find_last_not_of(), find_last_not_of(), find_last_of(), find_last_of(), find_last_of(), rfind(), rfind(), rfind(), String(), and substr().

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

- casa/BasicSL/String.h