12#include <OpenMS/OpenMSConfig.h>
23 template <
typename FloatingPo
intType>
24 struct PrecisionWrapper;
69 OPENMS_DLLAPI
String(
const std::string& s);
71 OPENMS_DLLAPI
String(
const std::string_view& sv);
73 OPENMS_DLLAPI
String(
const QString& s);
81 OPENMS_DLLAPI
String(
size_t len,
char c);
83 template <
class InputIterator>
84 String(InputIterator first, InputIterator last) :
85 std::string(first, last)
92 OPENMS_DLLAPI
String(
unsigned int i);
96 OPENMS_DLLAPI
String(
short unsigned int i);
100 OPENMS_DLLAPI
String(
long unsigned int i);
102 OPENMS_DLLAPI
String(
long long unsigned int i);
104 OPENMS_DLLAPI
String(
long long signed int i);
106 OPENMS_DLLAPI
String(
float f,
bool full_precision =
true);
108 OPENMS_DLLAPI
String(
double d,
bool full_precision =
true);
110 OPENMS_DLLAPI
String(
long double ld,
bool full_precision =
true);
434 OPENMS_DLLAPI
bool split(
const char splitter, std::vector<String>& substrings,
bool quote_protect =
false)
const;
447 OPENMS_DLLAPI
bool split(
const String& splitter, std::vector<String>& substrings)
const;
471 template <
class StringIterator>
477 std::string::clear();
481 std::string::operator=(*first);
482 for (StringIterator it = ++first; it != last; ++it)
484 std::string::operator+=(glue + (*it));
497 return std::hash<string>()(
static_cast<string>(s));
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition DataValue.h:34
A more convenient string class.
Definition String.h:34
String & operator+=(long unsigned int i)
Sum operator for an unsigned integer.
String(long long unsigned int i)
Constructor from an unsigned integer.
String & operator+=(short unsigned int i)
Sum operator for an unsigned integer.
const_reverse_iterator ConstReverseIterator
Const reverse Iterator.
Definition String.h:50
String substr(size_t pos=0, size_t n=npos) const
Wrapper for the STL substr() method. Returns a String object with its contents initialized to a subst...
String & operator+=(short int i)
Sum operator for an integer.
String(float f, bool full_precision=true)
Constructor from float (full_precision controls number of fractional digits, 3 digits when false,...
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
bool split_quoted(const String &splitter, std::vector< String > &substrings, char q='"', QuotingMethod method = ESCAPE) const
Splits a string into substrings using splitter (the whole string) as delimiter, but does not split wi...
String & operator+=(const char *s)
Sum operator for char*.
String(long int i)
Constructor from an integer.
String chop(Size n) const
Returns a substring where n characters were removed from the end of the string.
String(const std::string_view &sv)
Constructor from std::string_view.
bool hasSubstring(const String &string) const
true if String contains the string, false otherwise
String(const DataValue &d, bool full_precision=true)
Constructor from DataValue (full_precision controls number of fractional digits for all double types ...
String & operator+=(float f)
Sum operator for float.
reverse_iterator ReverseIterator
Reverse Iterator.
Definition String.h:48
String & unquote(char q='"', QuotingMethod method = ESCAPE)
Reverses changes made by the quote method.
Int64 toInt64() const
Conversion to Int64.
String & operator+=(int i)
Sum operator for an integer.
String & substitute(const String &from, const String &to)
Replaces all occurrences of the string from by the string to.
String prefix(SizeType length) const
returns the prefix of length length
String prefix(char delim) const
returns the prefix up to the first occurrence of char delim (excluding it)
iterator Iterator
Iterator.
Definition String.h:44
bool has(Byte byte) const
true if String contains the byte, false otherwise
Int toInt() const
Conversion to Int.
String(const char c)
Constructor from a char.
String(long long signed int i)
Constructor from an unsigned integer.
double toDouble() const
Conversion to double.
String(const std::string &s)
Constructor from std::string.
String & operator+=(double d)
Sum operator for double.
String(int i)
Constructor from an integer.
QString toQString() const
Conversion to Qt QString.
String & operator+=(unsigned int i)
Sum operator for an unsigned integer.
String operator+(char c) const
Sum operator for char.
String operator+(int i) const
Sum operator for an integer.
String operator+(long int i) const
Sum operator for an integer.
const_iterator ConstIterator
Const Iterator.
Definition String.h:46
QuotingMethod
How to handle embedded quotes when quoting strings.
Definition String.h:55
@ ESCAPE
Definition String.h:55
@ DOUBLE
Definition String.h:55
@ NONE
Definition String.h:55
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
String(const char *s, SizeType length)
Constructor from char* (only length characters)
String & remove(char what)
Remove all occurrences of the character what.
Int32 toInt32() const
Conversion to Int32.
String & reverse()
inverts the direction of the string
String & operator+=(long long unsigned int i)
Sum operator for an unsigned integer.
String operator+(const char *s) const
Sum operator for char*.
String operator+(short unsigned int i) const
Sum operator for an unsigned integer.
String & firstToUpper()
Converts the first letter of the string to uppercase.
String(short unsigned int i)
Constructor from an unsigned integer.
String & ensureLastChar(char end)
Makes sure the string ends with the character end.
String(const char *s)
Constructor from char*.
String operator+(double d) const
Sum operator for double.
String()
Default constructor.
String(String &&)=default
Move constructor.
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
bool isQuoted(char q='"')
Checks if the string is wrapped in quotation marks.
String & quote(char q='"', QuotingMethod method = ESCAPE)
Wraps the string in quotation marks.
static String numberLength(double d, UInt n)
Returns a string with at maximum n characters for d.
String operator+(float f) const
Sum operator for float.
String & operator+=(const std::string &s)
Sum operator for std::string.
String & operator=(String &&) &=default
Move assignment operator.
String(const String &)=default
Copy constructor.
String operator+(const std::string &s) const
Sum operator for std::string.
String & removeWhitespaces()
removes whitespaces (space, tab, line feed, carriage return)
String & simplify()
merges subsequent whitespaces to one blank character
size_type SizeType
UInt type.
Definition String.h:52
String prefix(Int length) const
returns the prefix of length length
String operator+(long unsigned int i) const
Sum operator for an unsigned integer.
String suffix(char delim) const
returns the suffix up to the last occurrence of char delim (excluding it)
String(double d, bool full_precision=true)
Constructor from double (full_precision controls number of fractional digits, 3 digits when false,...
String(size_t len, char c)
Constructor from char (repeats the char len times)
String(InputIterator first, InputIterator last)
Constructor from a char range.
Definition String.h:84
String(long double ld, bool full_precision=true)
Constructor from long double (full_precision controls number of fractional digits,...
String(long unsigned int i)
Constructor from an unsigned integer.
static String random(UInt length)
returns a random string of the given length. It consists of [0-9a-zA-Z]
String & operator+=(const String &s)
Sum operator for String.
String & fillLeft(char c, UInt size)
Adds c on the left side until the size of the string is size.
String operator+(long double ld) const
Sum operator for long double.
String suffix(SizeType length) const
returns the suffix of length length
String & operator+=(long double d)
Sum operator for long double.
String operator+(short int i) const
Sum operator for an integer.
String operator+(const String &s) const
Sum operator for String.
String suffix(Int length) const
returns the suffix of length length
String(short int i)
Constructor from an integer.
String & toLower()
Converts the string to lowercase.
bool split(const String &splitter, std::vector< String > &substrings) const
Splits a string into substrings using splitter (the whole string) as delimiter.
String operator+(unsigned int i) const
Sum operator for an unsigned integer.
static String number(double d, UInt n)
returns a string for d with exactly n decimal places
static const String EMPTY
Empty string for comparisons.
Definition String.h:38
String(unsigned int i)
Constructor from an unsigned integer.
float toFloat() const
Conversion to float.
String & toUpper()
Converts the string to uppercase.
String operator+(long long unsigned int i) const
Sum operator for an unsigned integer.
String & operator=(const String &)=default
Assignment operator.
String & fillRight(char c, UInt size)
Adds c on the right side until the size of the string is size.
String & substitute(char from, char to)
Replaces all occurrences of the character from by the character to.
String(const QString &s)
Constructor from Qt QString.
void concatenate(StringIterator first, StringIterator last, const String &glue="")
Concatenates all elements from first to last-1 and inserts glue between the elements.
Definition String.h:472
String & operator+=(long int i)
Sum operator for an integer.
String & operator+=(char c)
Sum operator for char.
int32_t Int32
Signed integer type (32bit)
Definition Types.h:26
int64_t Int64
Signed integer type (64bit)
Definition Types.h:40
uint8_t Byte
Byte type.
Definition Types.h:81
int Int
Signed integer type.
Definition Types.h:72
unsigned int UInt
Unsigned integer type.
Definition Types.h:64
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
::size_t hash_value(OpenMS::String const &s)
std::size_t operator()(OpenMS::String const &s) const
Definition String.h:495