String: the storage and methods of handling collections of characters. More...
#include <String.h>
Inherits std::string.
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 RegexBase &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 | rfind (const RegexBase &r, 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 |
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. | |
Bool | contains (Char c) const |
Containment. | |
Bool | contains (const string &str) const |
Bool | contains (const Char *s) const |
Bool | contains (const RegexBase &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. | |
Bool | contains (const string &str, Int pos) const |
Bool | contains (const Char *s, Int pos) const |
Bool | contains (const RegexBase &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 RegexBase &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 RegexBase &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 RegexBase &r, Int startpos=0) |
String | at (const RegexBase &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 RegexBase &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 RegexBase &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 RegexBase &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 RegexBase &r, size_type startpos=0) |
SubString | after (Int pos) |
Next one for overloading reasons. | |
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 RegexBase &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 RegexBase &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. |
String: the storage and methods of handling collections of characters.
Public interface
The String class name is a continuation of the "C" language custom of refering to collections of characters as "strings of characters".
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:
String myChar('C');
String myWord("Yowza");
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:
The Casacore additions are:
at(1,2) = ";"
) // 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(" ");
The String class eases the handling of characters within the Casacore environment.
Definition at line 223 of file String.h.
typedef string::allocator_type casacore::String::allocator_type |
typedef string::const_iterator casacore::String::const_iterator |
typedef string::const_pointer casacore::String::const_pointer |
typedef string::const_reference casacore::String::const_reference |
typedef string::const_reverse_iterator casacore::String::const_reverse_iterator |
typedef string::difference_type casacore::String::difference_type |
typedef string::iterator casacore::String::iterator |
typedef string::pointer casacore::String::pointer |
typedef string::reference casacore::String::reference |
typedef string::reverse_iterator casacore::String::reverse_iterator |
typedef string::size_type casacore::String::size_type |
typedef string::traits_type casacore::String::traits_type |
typedef string::value_type casacore::String::value_type |
casacore::String::String | ( | ) | [inline] |
casacore::String::String | ( | const Char * | s | ) | [inline] |
casacore::String::String | ( | InputIterator | begin, | |
InputIterator | end | |||
) | [inline] |
casacore::String::String | ( | Char | c | ) | [inline, explicit] |
casacore::String::String | ( | const SubString & | str | ) | [inline] |
casacore::String::String | ( | ostringstream & | os | ) |
Construct from a stream.
Start at startpos and extract the SubString "after" the argument's position, exclusive, to the String's end.
void casacore::String::alloc | ( | size_type | n | ) | [inline] |
Int casacore::String::allocation | ( | ) | const [inline] |
** Casacore addition -- works as a capacity(n) -- Note Int
Definition at line 347 of file String.h.
References capacity().
String& casacore::String::append | ( | InputIterator | first, | |
InputIterator | last | |||
) | [inline] |
String& casacore::String::append | ( | const string & | str | ) | [inline] |
Append.
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.
Referenced by append().
String& casacore::String::assign | ( | InputIterator | first, | |
InputIterator | last | |||
) | [inline] |
String& casacore::String::assign | ( | const string & | str | ) | [inline] |
Assign.
Definition at line 419 of file String.h.
Referenced by casa::sdfiller::DataAccumulator::accumulate(), and assign().
const_reference casacore::String::at | ( | size_type | n | ) | const [inline] |
Addressing.
Definition at line 382 of file String.h.
Referenced by at(), elem(), firstchar(), lastchar(), and operator[]().
const_iterator casacore::String::begin | ( | ) | const [inline] |
iterator casacore::String::begin | ( | ) | [inline] |
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 chars(), casacore::FunctionMarshallable::loadFuncType(), casacore::operator<<(), and casacore::AipsError::what().
size_type casacore::String::capacity | ( | ) | const [inline] |
Definition at line 345 of file String.h.
Referenced by allocation().
void casacore::String::capitalize | ( | ) |
internal transformation to capitalization of String.
const Char* casacore::String::chars | ( | ) | const [inline] |
** Casacore synonym
Definition at line 559 of file String.h.
References c_str().
Referenced by casacore::VariableArrayFITSFieldCopier< recordType, fitsType >::copyToFITS().
void casacore::String::clear | ( | ) | [inline] |
Int casacore::String::compare | ( | const string & | str | ) | const [inline] |
Bool casacore::String::contains | ( | const string & | str | ) | const [inline] |
const Char* casacore::String::data | ( | ) | const [inline] |
void casacore::String::del | ( | const string & | str, | |
size_type | startpos = 0 | |||
) |
Delete len chars starting at pos.
** Casacore addition
void casacore::String::downcase | ( | ) |
internal transformation to lowercase of String
const_reference casacore::String::elem | ( | size_type | pos | ) | const [inline] |
Bool casacore::String::empty | ( | ) | const [inline] |
Test for empty.
Definition at line 375 of file String.h.
Referenced by casacore::TempLatticeImpl< T >::canReferenceArray(), casacore::ColumnSlicer::ColumnSlicer(), casacore::TableKeyword::isFixed(), casacore::TempLatticeImpl< T >::isPaged(), casacore::TableMeasRefDesc::isRefCodeVariable(), casacore::TableQuantumDesc::isUnitVariable(), and casacore::TaqlRegex::match().
const_iterator casacore::String::end | ( | ) | const [inline] |
iterator casacore::String::end | ( | ) | [inline] |
Search functions.
Returns either npos (if not found); else position.
Warning: The RegexBase ones are ** Casacore additions
Definition at line 644 of file String.h.
Referenced by find(), casa::ScantableFieldIterator::getEntry(), and startsWith().
Definition at line 684 of file String.h.
References find_first_not_of().
size_type casacore::String::find_first_not_of | ( | const Char * | s, | |
size_type | pos, | |||
size_type | n | |||
) | const [inline] |
Definition at line 682 of file String.h.
References find_first_not_of().
Definition at line 680 of file String.h.
References find_first_not_of().
size_type casacore::String::find_first_not_of | ( | const string & | str, | |
size_type | pos = 0 | |||
) | const [inline] |
Definition at line 678 of file String.h.
Referenced by find_first_not_of().
Definition at line 668 of file String.h.
References find_first_of().
size_type casacore::String::find_first_of | ( | const Char * | s, | |
size_type | pos, | |||
size_type | n | |||
) | const [inline] |
Definition at line 666 of file String.h.
References find_first_of().
Definition at line 664 of file String.h.
References find_first_of().
Definition at line 662 of file String.h.
Referenced by find_first_of().
Definition at line 692 of file String.h.
References find_last_not_of().
size_type casacore::String::find_last_not_of | ( | const Char * | s, | |
size_type | pos, | |||
size_type | n | |||
) | const [inline] |
Definition at line 690 of file String.h.
References find_last_not_of().
size_type casacore::String::find_last_not_of | ( | const Char * | s, | |
size_type | pos = npos | |||
) | const [inline] |
Definition at line 688 of file String.h.
References find_last_not_of().
size_type casacore::String::find_last_not_of | ( | const string & | str, | |
size_type | pos = npos | |||
) | const [inline] |
Definition at line 686 of file String.h.
Referenced by find_last_not_of().
Definition at line 676 of file String.h.
References find_last_of().
size_type casacore::String::find_last_of | ( | const Char * | s, | |
size_type | pos, | |||
size_type | n | |||
) | const [inline] |
Definition at line 674 of file String.h.
References find_last_of().
Definition at line 672 of file String.h.
References find_last_of().
size_type casacore::String::find_last_of | ( | const string & | str, | |
size_type | pos = npos | |||
) | const [inline] |
Definition at line 670 of file String.h.
Referenced by find_last_of().
Char casacore::String::firstchar | ( | ) | const [inline] |
static String casacore::String::format | ( | const char * | picture, | |
... | ||||
) | [static] |
Create a formatted string using the given printf format string.
Referenced by casacore::ColumnSlicer::validateParameters().
Int casacore::String::freq | ( | const string & | str | ) | const |
Return the number of occurences of target in String.
Start at startpos and extract the SubString "from" the argument's position, inclusive, to the String's end.
T casacore::String::fromString | ( | ) | const [inline] |
Definition at line 593 of file String.h.
References casacore::value().
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, throwFromStringError(), and casacore::True.
allocator_type casacore::String::get_allocator | ( | ) | const [inline] |
Get allocator used
Warning: gcc has no get_allocator()
.
Int casacore::String::gsub | ( | const string & | pat, | |
const string & | repl | |||
) |
void casacore::String::insert | ( | iterator | p, | |
InputIterator | first, | |||
InputIterator | last | |||
) | [inline] |
Char casacore::String::lastchar | ( | ) | const [inline] |
size_type casacore::String::length | ( | ) | const [inline] |
Definition at line 343 of file String.h.
Referenced by casacore::VariableArrayFITSFieldCopier< recordType, fitsType >::copyToFITS(), and lastchar().
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 entire string from pos (or till pos if negative pos).
Referenced by casacore::TaqlRegex::match(), and matches().
Casacore addition: synonym for at(pos, len).
Definition at line 1019 of file String.h.
References casacore::SubString::String.
Definition at line 305 of file String.h.
References operator+=().
Definition at line 303 of file String.h.
References operator+=().
String& casacore::String::operator+= | ( | const string & | str | ) | [inline] |
Definition at line 294 of file String.h.
References operator=().
Definition at line 292 of file String.h.
References operator=().
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.
Referenced by operator=().
Definition at line 316 of file String.h.
References operator[]().
const_reference casacore::String::operator[] | ( | size_type | pos | ) | const [inline] |
void casacore::String::prepend | ( | Char | c | ) |
void casacore::String::prepend | ( | const Char * | s | ) |
void casacore::String::prepend | ( | const string & | str | ) |
Concatenate by prepending the argument onto String.
const_reverse_iterator casacore::String::rbegin | ( | ) | const [inline] |
reverse_iterator casacore::String::rbegin | ( | ) | [inline] |
const_reverse_iterator casacore::String::rend | ( | ) | const [inline] |
reverse_iterator casacore::String::rend | ( | ) | [inline] |
Resize by truncating or extending with copies of c
(default Char()).
Tip: The reserve length given is non-binding on the implementation
void casacore::String::reverse | ( | ) |
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_type casacore::String::size | ( | ) | const [inline] |
Bool casacore::String::startsWith | ( | const string & | beginString | ) | const [inline] |
Get a sub string.
Definition at line 570 of file String.h.
References String().
Referenced by casa::ScantableFieldIterator::getEntry().
Start at startpos and extract the SubString "through" to the argument's position, inclusive.
void casacore::String::throwFromStringError | ( | ) | const [private] |
Helper function for fromString.
Referenced by fromString().
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).
static 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.
Referenced by casacore::MArray< T >::flatten().
void casacore::String::trim | ( | char | c[], | |
uInt | n | |||
) |
Remove specified chars from beginning and end of string.
void casacore::String::trim | ( | ) |
Remove beginning and ending whitespace.
void casacore::String::upcase | ( | ) |
internal transformation to uppercase of String
const size_type casacore::String::npos [static] |