PIP 1.0.0_rc3 Platform-Independent Primitives

Public Member Functions | Related Functions | List of all members
PIStringList Class Reference

Strings array class. More...

Inherits PIDeque< T >.

## Public Member Functions
| PIStringList ()
| Contructs empty strings list.
| PIStringList (const PIString &str)
| Contructs strings list with one string "str".
| PIStringList (const PIString &s0, const PIString &s1)
| Contructs empty strings list with strings "s0" and "s1".
| PIStringList (const PIString &s0, const PIString &s1, const PIString &s2)
| Contructs empty strings list with strings "s0", "s1" and "s2".
| PIStringList (const PIString &s0, const PIString &s1, const PIString &s2, const PIString &s3)
| Contructs empty strings list with strings "s0", "s1", "s2" and "s3".
PIString | join (const PIString &delim) const
| Join all strings in one with delimiter "delim" and return it. More...
PIStringList & | removeStrings (const PIString &value)
| Remove all strings equal "value" and return this. More...
PIStringList & | removeDuplicates ()
| Remove duplicated strings and return this. More...
PIStringList & | trim ()
| Trim all strings. More...
uint | contentSize ()
| Return sum of lengths of all strings.
bool | operator== (const PIStringList &o) const
| Compare operator.
bool | operator!= (const PIStringList &o) const
| Compare operator.

## Related Functions
(Note that these are not member functions.)
std::ostream & | operator<< (std::ostream &s, const PIStringList &v)
| Output operator to std::ostream (cout)

## Detailed Description

Strings array class.

This class is based on PIDeque<PIString> and expand it functionality.

## Member Function Documentation

## ◆ join()

PIString PIStringList::join | ( | const PIString & | delim | ) | const
| inline

Join all strings in one with delimiter "delim" and return it.

Example:

PIStringList sl("1", "2");
sl << "3";
piCout << sl.join(" < "); // 1 < 2 < 3

## ◆ removeStrings()

PIStringList& PIStringList::removeStrings | ( | const PIString & | value | ) |
| inline

Remove all strings equal "value" and return this.

Example:

PIStringList sl("1", "2");
sl << "1" << "2" << "3";
piCout << sl; // {"1", "2", "1", "2", "3"}
piCout << sl.removeStrings("1"); // {"2", "2", "3"}

## ◆ removeDuplicates()

PIStringList & PIStringList::removeDuplicates | ( |  | ) |

Remove duplicated strings and return this.

Example:

PIStringList sl("1", "2");
sl << "1" << "2" << "3";
piCout << sl; // {"1", "2", "1", "2", "3"}
piCout << sl.removeDuplicates(); // {"1", "2", "3"}

## ◆ trim()

PIStringList& PIStringList::trim | ( |  | ) |
| inline

Trim all strings.

Example: