OpenMS
OpenMS::StringUtils Namespace Reference

Functions

static String number (double d, UInt n)
 
static QString toQString (const String &this_s)
 
static Int32 toInt32 (const String &this_s)
 
static Int64 toInt64 (const String &this_s)
 
static float toFloat (const String &this_s)
 
static double toDouble (const String &this_s)
 
template<typename IteratorT >
static bool extractDouble (IteratorT &begin, const IteratorT &end, double &target)
 
static String numberLength (double d, UInt n)
 Functions. More...
 
static StringfillLeft (String &this_s, char c, UInt size)
 
static StringfillRight (String &this_s, char c, UInt size)
 
static bool hasPrefix (const String &this_s, const String &string)
 
static bool hasSuffix (const String &this_s, const String &string)
 
static bool hasSubstring (const String &this_s, const String &string)
 
static bool has (const String &this_s, Byte byte)
 
static String prefix (const String &this_s, size_t length)
 
static String suffix (const String &this_s, size_t length)
 
static String prefix (const String &this_s, Int length)
 
static String suffix (const String &this_s, Int length)
 
static String prefix (const String &this_s, char delim)
 
static String suffix (const String &this_s, char delim)
 
static String substr (const String &this_s, size_t pos, size_t n)
 
static String chop (const String &this_s, Size n)
 
static Stringtrim (String &this_s)
 
static bool isQuoted (const String &this_s, char q)
 
static Stringquote (String &this_s, char q, String::QuotingMethod method)
 
static Stringunquote (String &this_s, char q, String::QuotingMethod method)
 
static Stringsimplify (String &this_s)
 
static String random (UInt length)
 
static Stringreverse (String &this_s)
 
static bool split (const String &this_s, const char splitter, std::vector< String > &substrings, bool quote_protect)
 
static bool split (const String &this_s, const String &splitter, std::vector< String > &substrings)
 
static bool split_quoted (const String &this_s, const String &splitter, std::vector< String > &substrings, char q, String::QuotingMethod method)
 
static StringtoUpper (String &this_s)
 
static StringfirstToUpper (String &this_s)
 
static StringtoLower (String &this_s)
 
static Stringsubstitute (String &this_s, char from, char to)
 
static Stringsubstitute (String &this_s, const String &from, const String &to)
 
static Stringremove (String &this_s, char what)
 
static StringensureLastChar (String &this_s, char end)
 
const char * skipWhitespace (const char *p, const char *p_end)
 Get the first non-whitespace character (anything but
, \t, \r, ' ') in the string pointed to by p (where p_end is past the end of the string). More...
 
int skipWhitespace (const std::string_view &data)
 Get the number of whitespace characters (
, \t, \r, ' ') in the prefix of data. More...
 
const char * skipNonWhitespace (const char *p, const char *p_end)
 Get the first whitespace character (
, \t, \r, ' ') in the string pointed to by p (where p_end is past the end of the string). More...
 
int skipNonWhitespace (const std::string_view &data)
 return the number of non-whitespace characters (anything but
, \t, \r, ' ') in the prefix of data More...
 
static StringremoveWhitespaces (String &this_s)
 

Function Documentation

◆ chop()

static String OpenMS::StringUtils::chop ( const String this_s,
Size  n 
)
inlinestatic

◆ ensureLastChar()

static String& OpenMS::StringUtils::ensureLastChar ( String this_s,
char  end 
)
inlinestatic

References String::hasSuffix().

◆ extractDouble()

static bool OpenMS::StringUtils::extractDouble ( IteratorT &  begin,
const IteratorT &  end,
double &  target 
)
static

◆ fillLeft()

static String& OpenMS::StringUtils::fillLeft ( String this_s,
char  c,
UInt  size 
)
inlinestatic

References OpenMS::Constants::c.

◆ fillRight()

static String& OpenMS::StringUtils::fillRight ( String this_s,
char  c,
UInt  size 
)
inlinestatic

References OpenMS::Constants::c.

◆ firstToUpper()

static String& OpenMS::StringUtils::firstToUpper ( String this_s)
inlinestatic

◆ has()

static bool OpenMS::StringUtils::has ( const String this_s,
Byte  byte 
)
inlinestatic

◆ hasPrefix()

static bool OpenMS::StringUtils::hasPrefix ( const String this_s,
const String string 
)
inlinestatic

Referenced by TOPPASBase::~TOPPASBase().

◆ hasSubstring()

static bool OpenMS::StringUtils::hasSubstring ( const String this_s,
const String string 
)
inlinestatic

◆ hasSuffix()

static bool OpenMS::StringUtils::hasSuffix ( const String this_s,
const String string 
)
inlinestatic

◆ isQuoted()

static bool OpenMS::StringUtils::isQuoted ( const String this_s,
char  q 
)
inlinestatic

Referenced by unquote().

◆ number()

static String OpenMS::StringUtils::number ( double  d,
UInt  n 
)
static

Referenced by MetaDataBrowser::add().

◆ numberLength()

static String OpenMS::StringUtils::numberLength ( double  d,
UInt  n 
)
inlinestatic

Functions.

References OpenMS::writtenDigits().

◆ prefix() [1/3]

static String OpenMS::StringUtils::prefix ( const String this_s,
char  delim 
)
inlinestatic

References String::substr().

◆ prefix() [2/3]

static String OpenMS::StringUtils::prefix ( const String this_s,
Int  length 
)
inlinestatic

References String::substr().

◆ prefix() [3/3]

static String OpenMS::StringUtils::prefix ( const String this_s,
size_t  length 
)
inlinestatic

References String::substr().

Referenced by DecoyHelper::countDecoys().

◆ quote()

static String& OpenMS::StringUtils::quote ( String this_s,
char  q,
String::QuotingMethod  method 
)
inlinestatic

◆ random()

static String OpenMS::StringUtils::random ( UInt  length)
inlinestatic

◆ remove()

static String& OpenMS::StringUtils::remove ( String this_s,
char  what 
)
inlinestatic

Referenced by TOPPFLASHDeconv::main_().

◆ removeWhitespaces()

static String& OpenMS::StringUtils::removeWhitespaces ( String this_s)
inlinestatic

◆ reverse()

◆ simplify()

static String& OpenMS::StringUtils::simplify ( String this_s)
inlinestatic

◆ skipNonWhitespace() [1/2]

const char* OpenMS::StringUtils::skipNonWhitespace ( const char *  p,
const char *  p_end 
)

Get the first whitespace character (
, \t, \r, ' ') in the string pointed to by p (where p_end is past the end of the string).

If only non-whitespaces are contained, then p_end is returned.

Referenced by removeWhitespaces(), and skipNonWhitespace().

◆ skipNonWhitespace() [2/2]

int OpenMS::StringUtils::skipNonWhitespace ( const std::string_view &  data)
inline

return the number of non-whitespace characters (anything but
, \t, \r, ' ') in the prefix of data

References skipNonWhitespace().

◆ skipWhitespace() [1/2]

const char* OpenMS::StringUtils::skipWhitespace ( const char *  p,
const char *  p_end 
)

Get the first non-whitespace character (anything but
, \t, \r, ' ') in the string pointed to by p (where p_end is past the end of the string).

If only whitespaces are contained, then p_end is returned.

Referenced by skipWhitespace().

◆ skipWhitespace() [2/2]

int OpenMS::StringUtils::skipWhitespace ( const std::string_view &  data)
inline

Get the number of whitespace characters (
, \t, \r, ' ') in the prefix of data.

References skipWhitespace().

◆ split() [1/2]

static bool OpenMS::StringUtils::split ( const String this_s,
const char  splitter,
std::vector< String > &  substrings,
bool  quote_protect 
)
inlinestatic

◆ split() [2/2]

static bool OpenMS::StringUtils::split ( const String this_s,
const String splitter,
std::vector< String > &  substrings 
)
inlinestatic

References String::substr().

◆ split_quoted()

static bool OpenMS::StringUtils::split_quoted ( const String this_s,
const String splitter,
std::vector< String > &  substrings,
char  q,
String::QuotingMethod  method 
)
inlinestatic

◆ substitute() [1/2]

static String& OpenMS::StringUtils::substitute ( String this_s,
char  from,
char  to 
)
inlinestatic

Referenced by TOPPASBase::~TOPPASBase().

◆ substitute() [2/2]

static String& OpenMS::StringUtils::substitute ( String this_s,
const String from,
const String to 
)
inlinestatic

◆ substr()

static String OpenMS::StringUtils::substr ( const String this_s,
size_t  pos,
size_t  n 
)
inlinestatic

◆ suffix() [1/3]

static String OpenMS::StringUtils::suffix ( const String this_s,
char  delim 
)
inlinestatic

References String::substr().

◆ suffix() [2/3]

static String OpenMS::StringUtils::suffix ( const String this_s,
Int  length 
)
inlinestatic

References String::substr().

◆ suffix() [3/3]

static String OpenMS::StringUtils::suffix ( const String this_s,
size_t  length 
)
inlinestatic

References String::substr().

Referenced by DecoyHelper::countDecoys().

◆ toDouble()

static double OpenMS::StringUtils::toDouble ( const String this_s)
static

◆ toFloat()

static float OpenMS::StringUtils::toFloat ( const String this_s)
static

◆ toInt32()

static Int32 OpenMS::StringUtils::toInt32 ( const String this_s)
static

◆ toInt64()

static Int64 OpenMS::StringUtils::toInt64 ( const String this_s)
static

◆ toLower()

static String& OpenMS::StringUtils::toLower ( String this_s)
inlinestatic

◆ toQString()

◆ toUpper()

static String& OpenMS::StringUtils::toUpper ( String this_s)
inlinestatic

◆ trim()

static String& OpenMS::StringUtils::trim ( String this_s)
inlinestatic

◆ unquote()

static String& OpenMS::StringUtils::unquote ( String this_s,
char  q,
String::QuotingMethod  method 
)
inlinestatic