117 template<
class charT>
129 template<
class charT>
131 std::basic_string<charT>(n,c)
147 template<
class charT>
155 if (!A.size())
return;
161 assert(
static_cast<typename std::basic_string<charT>::size_type
>(pos)<A.size());
166 (
static_cast<typename std::basic_string<charT>::size_type
>(numpos)<=(A.size()-pos))
178 std::basic_string<charT>::operator=(std::basic_string<charT>(A,pos,numpos));
183 template<
class charT>
194 template<
class charT>
197 std::basic_string<charT>::operator=(A);
207 template<
class charT>
211 size_t searchstr_size = searchstr.size();
212 size_t insstr_size = insstr.size();
213 size_t start_pos = 0;
215 while (start_pos != std::string::npos)
217 start_pos = this->find (searchstr, start_pos);
218 if (start_pos && start_pos != std::string::npos)
220 this->insert (start_pos, insstr);
221 start_pos += searchstr_size + insstr_size;
232 template<
class charT>
240 while (oldpos < (
size_t)this->
nelem() &&
243 if (pos && pos-oldpos) aos.push_back(this->substr(oldpos, pos-oldpos));
244 oldpos = pos+delim.
nelem();
247 if (oldpos < (
size_t)this->
nelem()) aos.push_back(this->substr(oldpos));
252 template<
class charT>
259 while (0 != this_string.
nelem()
260 && (
' ' == this_string[0]
261 ||
'\t' == this_string[0]
262 ||
'\n' == this_string[0]
263 ||
'\r' == this_string[0]))
264 this_string.erase(0,1);
267 while (0 != this_string.
nelem()
268 && (
' ' == this_string[this_string.
nelem()-1]
269 ||
'\t' == this_string[this_string.
nelem()-1]
270 ||
'\n' == this_string[this_string.
nelem()-1]
271 ||
'\r' == this_string[this_string.
nelem()-1]))
272 this_string.erase(this_string.
nelem()-1);
277 template<
class charT>
280 size_t s = this->size();
282 return static_cast<long>(s);
292 template<
class charT>
297 return std::basic_string<charT>::operator[](n);
307 template<
class charT>
312 return std::basic_string<charT>::operator[](n);
344 std::istringstream item( line.substr(0,n) );
INDEX Index
The type to use for all integer numbers and indices.
char operator[](Index n) const
Constant index operator.
my_basic_string()
Default constructor.
This file contains the definition of Array.
The implementation for String, the ARTS string class.
void insert_substr(const my_basic_string< charT > &searchstr, const my_basic_string< charT > &insstr)
Insert string before all occurrences of the substring.
my_basic_string & operator=(const my_basic_string< charT > &A)
Assignment from another my_basic_string.
void toupper()
Convert to upper case.
void tolower()
Convert to lower case.
void extract(T &x, String &line, Index n)
Extract something from the beginning of a string.
Index nelem() const
Number of elements.
Array< String > ArrayOfString
An array of Strings.
void trim()
Trim leading and trailing whitespace.
This can be used to make arrays out of anything.
void split(Array< my_basic_string< charT > > &aos, const my_basic_string< charT > &delim) const
Split string into substrings.
void transform(VectorView y, double(&my_func)(double), ConstVectorView x)
A generic transform function for vectors, which can be used to implement mathematical functions opera...
static const Index npos
Define npos:
my_basic_string< char > String
The String type for ARTS.