#include <ststringlist.h>
Inheritance diagram for StStringList:
Public Member Functions | |
StStringList () | |
StStringList (const StString &str) | |
StStringList (const StValueList< StString > &list) | |
bool | load (StFile file) |
bool | save (StFile file) |
StString | join (const StString &glue) |
StStringList & | removeEmpty (bool ignoreSpaces=true, bool ignoreTabs=true) |
Static Public Member Functions | |
static StStringList | split (const StString &sep, const StString &str, bool allowEmptyEntires=false) |
Private Member Functions | |
void | init () |
This class is StValueList<StString> with possibility of load() lines of file, and save() contents to another file. You can also split() existing StString by seperator or join() all strings into one.
StStringList::StStringList | ( | ) |
StStringList::StStringList | ( | const StString & | str | ) | [inline] |
StStringList::StStringList | ( | const StValueList< StString > & | list | ) | [inline] |
void StStringList::init | ( | ) | [private] |
Reimplemented from StValueList< StString >.
Join all strings into one seperated by glue and return the result in one StString.
bool StStringList::load | ( | StFile | file | ) |
Load file lines into string list. It doesn't erase existing strings but appends new ones.
Reimplemented in StScript.
StStringList & StStringList::removeEmpty | ( | bool | ignoreSpaces = true , |
|
bool | ignoreTabs = true | |||
) |
Removes empty lines.
bool StStringList::save | ( | StFile | file | ) |
Save all strings into a file as seperate lines. If file exists, its context will be erased.
static StStringList StStringList::split | ( | const StString & | sep, | |
const StString & | str, | |||
bool | allowEmptyEntires = false | |||
) | [static] |
Split string to StStringList by sep. If allowEmptyEntires is true, then empty fields between two seperators will also be included.
Example:
StString str = "Johny||Wayne||Poland||"; // we will not accept blank entries StStringList strList1 = StStringList::split("||", str, false); // now strList1.size() will return 3 // strList1[0] == "Johny" // strList1[1] == "Wayne" // strList1[2] == "Poland" StStringList strList2 = StStringList::split("||", str, true); // strList2.size() will return 4 // and strList[3] == ""