84 SubString(
const string &str, string::size_type pos,
85 string::size_type len);
257 string(str, pos, n) {}
271 template<
class InputIterator>
281 String(ostringstream &os);
293 return (*
this =
String(str)); }
304 return static_cast<String&
>(string::operator+=(str)); }
306 return static_cast<String&
>(string::operator+=(s)); }
308 return static_cast<String&
>(string::operator+=(c)); }
317 return string::at(pos); }
319 return string::operator[](pos); }
323 return string::at(pos); }
362 string::resize(n);
return *
this; }
364 string::resize(n, c);
return *
this; }
366 string::reserve(res_arg);
return *
this; }
399 return static_cast<String&
>(string::append(str)); }
401 return static_cast<String&
>(string::append(str, pos, n)); }
403 return static_cast<String&
>(string::append(s, n)); }
405 return static_cast<String&
>(string::append(s)); }
407 return static_cast<String&
>(string::append(n, c)); }
408 template<
class InputIterator>
410 return static_cast<String&
>(string::append(first, last)); }
413 return static_cast<String&
>(string::append(1, c)); }
422 return static_cast<String&
>(string::assign(str)); }
424 return static_cast<String&
>(string::assign(str, pos, n)); }
426 return static_cast<String&
>(string::assign(s, n)); }
428 return static_cast<String&
>(string::assign(s)); }
430 return static_cast<String&
>(string::assign(n, c)); }
431 template<
class InputIterator>
433 return static_cast<String&
>(string::assign(first, last)); }
436 return static_cast<String&
>(string::assign(1, c)); }
446 return static_cast<String&
>(string::insert(pos1, str)); }
449 return static_cast<String&
>(string::insert(pos1, str, pos2, n)); }
451 return static_cast<String&
>(string::insert(pos, s, n)); }
453 return static_cast<String&
>(string::insert(pos, s)); }
455 return static_cast<String&
>(string::insert(pos, n, c)); }
458 return static_cast<String&
>(string::insert(pos, 1, c)); }
461 return string::insert(p, c); }
463 string::insert(p, n, c); }
464 template<
class InputIterator>
466 string::insert(p, first, last); }
470 return static_cast<String&
>(string::insert(p-
begin(), str)); }
472 return static_cast<String&
>(string::insert(p-
begin(), s, n)); }
474 return static_cast<String&
>(string::insert(p-
begin(), s)); }
484 return string::compare(str); }
486 return String(*
this, pos1, n1).compare(str); }
489 return String(*
this, pos1, n1).compare(
String(str, pos2, n2)); }
491 return string::compare(s); }
494 return String(*
this, pos1, n1).compare(
String(s, n2)); }
500 return static_cast<String&
>(string::erase(pos, n)); }
502 return string::erase(position); }
504 return string::erase(first, last); }
538 template<
class InputIterator>
559 const Char *
data()
const {
return string::data(); }
573 return String(*
this, pos, n); }
587 std::istringstream os(*
this);
589 if (os.fail() || !os.eof()) {
618 std::ostringstream os;
641 {
return find(beginString) == 0; }
647 return string::find(str, pos); }
649 return string::find(s, pos); }
651 return string::find(s, pos, n); }
653 return string::find(c, pos); }
656 return string::rfind(str, pos); }
658 return string::rfind(s, pos); }
660 return string::rfind(s, pos, n); }
662 return string::rfind(c, pos); }
664 return string::find_first_of(str, pos); }
666 return string::find_first_of(s, pos); }
668 return string::find_first_of(s, pos, n); }
670 return string::find_first_of(c, pos); }
672 return string::find_last_of(str, pos); }
674 return string::find_last_of(s, pos); }
676 return string::find_last_of(s, pos, n); }
678 return string::find_last_of(c, pos); }
680 return string::find_first_not_of(str, pos); }
682 return string::find_first_not_of(s, pos); }
684 return string::find_first_not_of(s, pos, n); }
686 return string::find_first_not_of(c, pos); }
688 return string::find_last_not_of(str, pos); }
690 return string::find_last_not_of(s, pos); }
692 return string::find_last_not_of(s, pos, n); }
694 return string::find_last_not_of(c, pos); }
730 void prepend(
const string &str);
739 return ((startpos >= 0) ?
find(c, startpos) :
742 return ((startpos >= 0) ?
find(str, startpos) :
745 return ((startpos >= 0) ?
find(s, startpos) :
753 Int freq(
const string &str)
const;
761 return String(*
this, pos, len); }
763 String at(
const string &str,
Int startpos = 0)
const;
775 return at(static_cast<size_type>(pos), static_cast<size_type>(len));
778 return at(static_cast<size_type>(pos), static_cast<size_type>(len));
781 return at(static_cast<size_type>(pos), len);
784 return at(static_cast<size_type>(pos), len);
799 return before(static_cast<size_type>(pos)); };
812 return through(static_cast<size_type>(pos)); }
825 return from(static_cast<size_type>(pos));
839 return after(static_cast<size_type>(pos));
866 del(static_cast<size_type>(pos), static_cast<size_type>(len)); }
873 Int gsub(
const string &pat,
const string &repl);
897 String str(lhs); str.append(rhs);
return str; }
899 String str(lhs); str.append(rhs);
return str; }
901 String str(lhs); str.append(rhs);
return str; }
903 String str(lhs); str.append(rhs);
return str; }
905 String str(lhs); str.append(rhs);
return str; }
954 return x.compare(y); }
956 return x.compare(y); }
958 return x.compare(
String(y)); }
969 Int split(
const string &str,
string res[],
Int maxn,
971 Int split(
const string &str,
string res[],
Int maxn,
973 Int split(
const string &str,
string res[],
Int maxn,
980 String common_prefix(
const string &x,
const string &y,
982 String common_suffix(
const string &x,
const string &y,
986 String join(
string src[],
Int n,
const string &sep);
993 String reverse(
const string& str);
1013 string::size_type len) :
1014 ref_p(str), pos_p((pos > str.
length()) ? str.
length() : pos),
1015 len_p((len == string::npos || pos_p+len > str.
length()) ?
1016 str.
length()-pos_p : len) {}
1019 return at(pos, len); }
1021 return String(*this).c_str(); }
1033 s << x.
c_str();
return s; }
allocator_type get_allocator() const
Get allocator used Warning: gcc has no get_allocator()
String & assign(size_type n, Char c)
Int compare(const string &x, const string &y)
** Casacore additions of global compares.
String & resize(size_type n, Char c)
String & insert(size_type pos, size_type n, Char c)
String & replace(size_type pos, size_type n1, const Char *s)
void rtrim(char c)
Remove specified character from end of string.
Int compare(const Char *s) const
String & insert(iterator p, const Char *s, size_type n)
static Int toInt(const String &s, Bool chk=False)
Convert a string to an Int, Float or Double.
void reverse()
Maybe forget some.
String & replace(iterator i1, iterator i2, const Char *s, size_type n)
String & replace(iterator i1, iterator i2, size_type n, Char c)
TableExprNode downcase(const TableExprNode &node)
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
size_type rfind(Char c, size_type pos=npos) const
iterator erase(iterator position)
size_type capacity() const
void ltrim(char c)
Remove specified character from beginning of string.
void swap(string &s)
Swap.
size_type rfind(const Char *s, size_type pos, size_type n) const
size_type find_last_of(const string &str, size_type pos=npos) const
String & replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2)
String & append(const Char *s, size_type n)
size_type find_last_not_of(Char c, size_type pos=npos) const
size_type find_first_not_of(const Char *s, size_type pos=0) const
String & operator=(Char c)
const Char * chars() const
Get as (const) C array.
size_type index(Char c, Int startpos=0) const
Return the position of the target in the string or npos for failure.
size_type rfind(const Char *s, size_type pos=npos) const
Int gsub(const string &pat, const string &repl)
Global substitution: substitute all occurrences of pat with repl, and return the number of replacemen...
String & reserve(size_type res_arg=0)
String & append(const Char *s)
String & insert(size_type pos, const Char *s)
size_type find(Char c, size_type pos=0) const
size_type copy(Char *s, size_type n, size_type pos=0) const
Copy.
Bool matches(Char c, Int pos=0) const
string::value_type value_type
reverse_iterator rbegin()
string::size_type pos_p
Start of sub-string.
size_type find_last_of(const Char *s, size_type pos, size_type n) const
PtrHolder< T > & operator=(const PtrHolder< T > &other)
size_type size() const
Capacity, size.
String & resize(size_type n)
Resize by truncating or extending with copies of <tt>c</tt> (default Char())
reference at(size_type n)
Int compare(const string &str) const
Compare.
SubString after(size_type pos)
Start at startpos and extract the SubString "after" the argument's position, exclusive, to the String's end.
String & assign(InputIterator first, InputIterator last)
String & operator=(const SubString &str)
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
void prepend(const string &str)
Concatenate by prepending the argument onto String.
Int allocation() const
** Casacore addition – works as a capacity(n) – Note Int
const_reverse_iterator rbegin() const
void upcase()
internal transformation to uppercase of String
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
String & replace(iterator i1, iterator i2, const Char *s)
String & assign(Char c)
** Casacore addition
SubString at(Int pos, Int len)
Next ones for overloading reasons.
size_type find_first_of(const string &str, size_type pos=0) const
string::size_type length() const
Obtain length.
String & replace(size_type pos, size_type n1, size_type n2, Char c)
String at(Int pos, size_type len) const
String & assign(const string &str, size_type pos, size_type n)
string::reference reference
String & insert(iterator p, const string &str)
** Casacore additions
String & replace(iterator i1, iterator i2, Char c)
** Casacore addition
iterator begin()
Iterators.
String & assign(const Char *s, size_type n)
Int freq(Char c) const
Return the number of occurences of target in String.
string::iterator iterator
SubString through(Int pos)
Next one for overloading reasons.
size_type find_first_not_of(const string &str, size_type pos=0) const
LatticeExprNode operator>=(const LatticeExprNode &left, const LatticeExprNode &right)
iterator erase(iterator first, iterator last)
SubString before(Int pos) const
Next one for overloading reasons.
string::allocator_type allocator_type
String & assign(const Char *s)
String & replace(size_type pos1, size_type n1, const string &str, size_type pos2, size_type n2)
const string & ref_p
Referenced string.
size_type find(const Char *s, size_type pos=0) const
const_reference at(size_type n) const
Addressing.
Vector< String > & split(const String &s, char delim, Vector< String > &elems)
SubString _substr(size_type first, size_type l) const
Helper functions for at, before etc.
static Float toFloat(const String &s, Bool chk=False)
String & insert(size_type pos1, const string &str, size_type pos2, size_type n)
size_type find_first_not_of(Char c, size_type pos=0) const
void throwFromStringError() const
Helper function for fromString.
size_type find_last_of(Char c, size_type pos=npos) const
string::const_pointer const_pointer
SubString operator()(size_type pos, size_type len)
Casacore addition: synonym for at(pos, len)
void clear()
Clear the string Warning: clear() executed as erase() due to missing clear() in gcc ...
LatticeExprNode replace(const LatticeExprNode &arg1, const LatticeExprNode &arg2)
This function replaces every masked-off element in the first argument with the corresponding element ...
SubString(const SubString &)=default
Default copy constructor.
string::difference_type difference_type
SubString help class to be used in at, before,...
size_type find_first_not_of(const Char *s, size_type pos, size_type n) const
string::size_type size_type
String & insert(size_type pos, Char c)
** Casacore addition
Regular expression class (based on std::regex)
LatticeExprNode length(const LatticeExprNode &expr, const LatticeExprNode &axis)
2-argument function to get the length of an axis.
size_type rfind(const string &str, size_type pos=npos) const
String & erase(size_type pos, size_type n=npos)
Erase.
TableExprNode trim(const TableExprNode &node)
String & assign(const string &str)
Assign.
Bool startsWith(const string &beginString) const
Does the string start with the specified string?
LatticeExprNode operator<=(const LatticeExprNode &left, const LatticeExprNode &right)
const Char * chars() const
** Casacore synonym
String & insert(size_type pos1, const string &str)
Insert.
const Char * c_str() const
Get char array.
size_type find_last_of(const Char *s, size_type pos=npos) const
void insert(iterator p, InputIterator first, InputIterator last)
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 substr(size_type pos=0, size_type n=npos) const
Get a sub string.
String & operator+=(const string &str)
Concatenate.
SubString & operator=(const SubString &str)
Assignment.
size_type find_first_of(Char c, size_type pos=0) const
const_reverse_iterator rend() const
size_type find_last_not_of(const string &str, size_type pos=npos) const
bool Bool
Define the standard types used by Casacore.
size_type find_first_of(const Char *s, size_type pos=0) const
void trim()
Remove beginning and ending whitespace.
TableExprNode upcase(const TableExprNode &node)
String()
Default constructor.
reference operator[](size_type pos)
void swap(Array< T, Alloc > &first, Array< T, Alloc > &second)
Swap the first array with the second.
static Double toDouble(const String &s, Bool chk=False)
String & operator+=(const Char *s)
void insert(iterator p, size_type n, Char c)
static String format(const char *picture,...)
Create a formatted string using the given printf format string.
string::const_iterator const_iterator
Int compare(const string &x, const Char y)
SubString at(Int pos, size_type len)
string::const_reference const_reference
const_reference operator[](size_type pos) const
Indexing.
void alloc(size_type n)
** Casacore addition – works as a resize(n)
LatticeExprNode operator>(const LatticeExprNode &left, const LatticeExprNode &right)
SubString before(size_type pos) const
Start at startpos and extract the string "before" the argument's position, exclusive.
String & replace(size_type pos1, size_type n1, const string &str)
Replace.
String & insert(size_type pos, const Char *s, size_type n)
string::size_type len_p
Length of sub-string.
Int compare(size_type pos1, size_type n1, const string &str, size_type pos2, size_type n2) const
const_reference elem(size_type pos) const
*** Casacore addition
String at(Int pos, Int len) const
String(size_type n, Char c)
Construct from a single char (repeated n times)
Int compare(const string &x, const Char *y)
String(const Char *s)
Construct from char array.
size_type find(const string &str, size_type pos=0) const
Search functions.
string::reverse_iterator reverse_iterator
String(const SubString &str)
Construct from a SubString.
LatticeExprNode operator+(const LatticeExprNode &expr)
Global functions operating on a LatticeExprNode.
String & append(InputIterator first, InputIterator last)
String & operator=(const string &str)
Assignments (they are all deep copies according to standard)
SubString from(size_type pos)
Start at startpos and extract the SubString "from" the argument's position, inclusive, to the String's end.
void del(Int pos, Int len)
Overload problem.
Bool fromString(T &value, Bool chk=True) const
Convert a String to a value.
String & insert(iterator p, const Char *s)
size_type max_size() const
String & operator+=(Char c)
iterator insert(iterator p, Char c)
String & replace(size_type pos, size_type n1, Char c)
** Casacore addition
string::traits_type traits_type
const Double c
Fundamental physical constants (SI units):
String & append(size_type n, Char c)
size_type find_last_not_of(const Char *s, size_type pos, size_type n) const
TableExprNode capitalize(const TableExprNode &node)
Bool matches(const string &str, Int pos=0) const
Matches entire string from pos (or till pos if negative pos).
String: the storage and methods of handling collections of characters.
String & append(Char c)
** Casacore addition
size_type find_last_not_of(const Char *s, size_type pos=npos) const
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
Int compare(size_type pos1, size_type n1, const string &str) const
String(InputIterator begin, InputIterator end)
Construct from iterator.
Bool contains(Char c) const
Containment.
const_iterator begin() const
SubString through(size_type pos)
Start at startpos and extract the SubString "through" to the argument's position, inclusive.
string::const_reverse_iterator const_reverse_iterator
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
String(Char c)
From single char (** Casacore addition).
static const size_type npos
size_type find_first_of(const Char *s, size_type pos, size_type n) const
const_iterator end() const
const Char * data() const
As pointer to char array.
void downcase()
internal transformation to lowercase of String
size_type find(const Char *s, size_type pos, size_type n) const
String & append(const string &str)
Append.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
String & operator=(const Char *s)
String at(size_type pos, size_type len) const
String(const Char *s, size_type n)
Construct from char* with given length.
Int compare(size_type pos1, size_type n1, const Char *s, size_type n2=npos) const
void del(size_type pos, size_type len)
Delete len chars starting at pos.
String & replace(iterator i1, iterator i2, const string &str)
String & replace(size_type pos, size_type n1, const Char *s, size_type n2)
String & append(const string &str, size_type pos, size_type n)
void capitalize()
internal transformation to capitalization of String.
static String toString(const T &value)
Convert a value to a String.
SubString after(Int pos)
Next one for overloading reasons.
SubString from(Int pos)
Next one for overloading reasons.
Bool empty() const
Test for empty.
Bool matches(const Char *s, Int pos=0) const