| OpenMS 2.5.0

Static Public Member Functions | Private Member Functions | List of all members
StringListUtils Class Reference
Datastructures

Utilities operating on lists of Strings. More...

`#include <OpenMS/DATASTRUCTURES/StringListUtils.h>`

## Public Types

Type definitions
typedef std::vector< String >::iterator | Iterator
| Mutable iterator. More...
typedef std::vector< String >::const_iterator | ConstIterator
| Non-mutable iterator. More...
typedef std::vector< String >::reverse_iterator | ReverseIterator
| Mutable reverse iterator. More...
typedef std::vector< String >::const_reverse_iterator | ConstReverseIterator
| Non-mutable reverse iterator. More...

## Static Public Member Functions

static StringList | fromQStringList (const QStringList &rhs)
| Creates a StringList from a QStringList. More...
static void | toUpper (StringList &sl)
| Transforms all strings contained in the passed StringList to upper case. More...
static void | toLower (StringList &sl)
| Transforms all strings contained in the passed StringList to lower case. More...
Search methods
static Iterator | searchPrefix (const Iterator &start, const Iterator &end, const String &text, bool trim=false)
| Searches for the first line that starts with `text` beginning at line `start`. More...
static ConstIterator | searchPrefix (const ConstIterator &start, const ConstIterator &end, const String &text, bool trim=false)
| Searches for the first line that starts with `text` beginning at line `start`. More...
static ConstIterator | searchPrefix (const StringList &container, const String &text, bool trim=false)
| Searches for the first line that starts with `text` in the StringList `container`. More...
static Iterator | searchPrefix (StringList &container, const String &text, bool trim=false)
| Searches for the first line that starts with `text` in the StringList `container`. More...
static Iterator | searchSuffix (const Iterator &start, const Iterator &end, const String &text, bool trim=false)
| Searches for the first line that ends with `text` beginning at line `start`. More...
static ConstIterator | searchSuffix (const ConstIterator &start, const ConstIterator &end, const String &text, bool trim=false)
| Searches for the first line that ends with `text` beginning at line `start`. More...
static ConstIterator | searchSuffix (const StringList &container, const String &text, bool trim=false)
| Searches for the first line that ends with `text` in the StringList `container`. More...
static Iterator | searchSuffix (StringList &container, const String &text, bool trim=false)
| Searches for the first line that ends with `text` in the StringList `container`. More...

## Private Member Functions

INTERNAL | StringListUtils ()
| hide c'tors to avoid instantiation of utils class More...
| StringListUtils (const StringListUtils &)
StringListUtils & | operator= (StringListUtils &)

## Detailed Description

Utilities operating on lists of Strings.

## Member Typedef Documentation

## ◆ ConstIterator

typedef std::vector<String>::const_iterator ConstIterator

Non-mutable iterator.

## ◆ ConstReverseIterator

typedef std::vector<String>::const_reverse_iterator ConstReverseIterator

Non-mutable reverse iterator.

## ◆ Iterator

typedef std::vector<String>::iterator Iterator

Mutable iterator.

## ◆ ReverseIterator

typedef std::vector<String>::reverse_iterator ReverseIterator

Mutable reverse iterator.

## Constructor & Destructor Documentation

## ◆ StringListUtils() [1/2]

INTERNAL StringListUtils | ( |  | ) |

inline private

hide c'tors to avoid instantiation of utils class

## ◆ StringListUtils() [2/2]

StringListUtils | ( | const StringListUtils & |  | ) |

inline private

## Member Function Documentation

## ◆ fromQStringList()

static StringList fromQStringList | ( | const QStringList & | rhs | ) |

static

Creates a StringList from a QStringList.

## ◆ operator=()

StringListUtils& operator= | ( | StringListUtils & |  | ) |

inline private

## ◆ searchPrefix() [1/4]

static Iterator searchPrefix | ( | const Iterator & | start,
|  | const Iterator & | end,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that starts with `text` beginning at line `start`.

Parameters

  start | Iterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
  end | Iterator pointing to the end final position of the sequence to search.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchPrefix() [2/4]

static ConstIterator searchPrefix | ( | const ConstIterator & | start,
|  | const ConstIterator & | end,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that starts with `text` beginning at line `start`.

Parameters

  start | Iterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
  end | Iterator pointing to the end final position of the sequence to search.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchPrefix() [3/4]

static ConstIterator searchPrefix | ( | const StringList & | container,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that starts with `text` in the StringList `container`.

Parameters

  container | The StringList that should be searched.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchPrefix() [4/4]

static Iterator searchPrefix | ( | StringList & | container,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that starts with `text` in the StringList `container`.

Parameters

  container | The StringList that should be searched.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchSuffix() [1/4]

static Iterator searchSuffix | ( | const Iterator & | start,
|  | const Iterator & | end,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that ends with `text` beginning at line `start`.

Parameters

  start | Iterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
  end | Iterator pointing to the end final position of the sequence to search.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchSuffix() [2/4]

static ConstIterator searchSuffix | ( | const ConstIterator & | start,
|  | const ConstIterator & | end,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that ends with `text` beginning at line `start`.

Parameters

  start | Iterator pointing to the initial position to search. (note: that this does not need to correspond to the beginning of the container.
  end | Iterator pointing to the end final position of the sequence to search.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchSuffix() [3/4]

static ConstIterator searchSuffix | ( | const StringList & | container,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that ends with `text` in the StringList `container`.

Parameters

  container | The StringList that should be searched.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ searchSuffix() [4/4]

static Iterator searchSuffix | ( | StringList & | container,
|  | const String & | text,
|  | bool | trim = `false`
| ) |  |

static

Searches for the first line that ends with `text` in the StringList `container`.

Parameters

  container | The StringList that should be searched.
  text | The text to find
  trim | Whether the line is trimmed before

Returns
  Returns an iterator to the matching entry. If no line matches end is returned.

## ◆ toLower()

static void toLower | ( | StringList & | sl | ) |

static

Transforms all strings contained in the passed StringList to lower case.

Parameters

  The | StringList to convert to lower case.

## ◆ toUpper()

static void toUpper | ( | StringList & | sl | ) |

static

Transforms all strings contained in the passed StringList to upper case.

Parameters

  sl | The StringList to convert to upper case.