54 template <
class charT>
122 template <
class charT>
124 :
std::basic_string<charT>(n, c) {
139 template <
class charT>
141 const std::basic_string<charT>& A,
Index pos,
Index numpos) {
145 if (!A.size())
return;
151 assert(
static_cast<typename std::basic_string<charT>::size_type
>(pos) <
157 (
static_cast<typename std::basic_string<charT>::size_type
>(numpos) <=
169 std::basic_string<charT>::operator=(std::basic_string<charT>(A, pos, numpos));
173 template <
class charT>
175 :
std::basic_string<charT>(A) {
183 template <
class charT>
187 size_t searchstr_size = searchstr.size();
188 size_t insstr_size = insstr.size();
189 size_t start_pos = 0;
191 while (start_pos != std::string::npos) {
192 start_pos = this->find(searchstr, start_pos);
193 if (start_pos && start_pos != std::string::npos) {
194 this->insert(start_pos, insstr);
195 start_pos += searchstr_size + insstr_size;
205 template <
class charT>
213 while (oldpos < (
size_t)this->
nelem() &&
214 (pos = this->find(delim, oldpos)) !=
216 if (pos && pos - oldpos) aos.push_back(this->substr(oldpos, pos - oldpos));
217 oldpos = pos + delim.
nelem();
220 if (oldpos < (
size_t)this->
nelem()) aos.push_back(this->substr(oldpos));
224 template <
class charT>
230 while (0 != this_string.
nelem() &&
231 (
' ' == this_string[0] ||
'\t' == this_string[0] ||
232 '\n' == this_string[0] ||
'\r' == this_string[0]))
233 this_string.erase(0, 1);
236 while (0 != this_string.
nelem() &&
237 (
' ' == this_string[this_string.
nelem() - 1] ||
238 '\t' == this_string[this_string.
nelem() - 1] ||
239 '\n' == this_string[this_string.
nelem() - 1] ||
240 '\r' == this_string[this_string.
nelem() - 1]))
241 this_string.erase(this_string.
nelem() - 1);
245 template <
class charT>
247 size_t s = this->size();
248 assert(s < LONG_MAX);
249 return static_cast<long>(s);
258 template <
class charT>
262 return std::basic_string<charT>::operator[](n);
271 template <
class charT>
275 return std::basic_string<charT>::operator[](n);
INDEX Index
The type to use for all integer numbers and indices.
char operator[](Index n) const
Constant index operator.
basic_istringstream< char, string_char_traits< char >, alloc > istringstream
This file contains the definition of Array.
The implementation for String, the ARTS string class.
Array< Array< String > > ArrayOfArrayOfString
An array of Strings.
void insert_substr(const my_basic_string< charT > &searchstr, const my_basic_string< charT > &insstr)
Insert string before all occurrences of the substring.
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.
my_basic_string()=default
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.
my_basic_string tolower() const
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:
constexpr Rational end(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the largest M for a polarization type of this transition.
my_basic_string toupper() const
my_basic_string< char > String
The String type for ARTS.