StStringList Class Reference

StValueList<StString> with some new methods. More...

#include <ststringlist.h>

Inheritance diagram for StStringList:

StValueList< StString > StScript List of all members.

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)
StStringListremoveEmpty (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 ()

Detailed Description

StValueList<StString> with some new methods.

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.


Constructor & Destructor Documentation

StStringList::StStringList (  ) 

StStringList::StStringList ( const StString str  )  [inline]

StStringList::StStringList ( const StValueList< StString > &  list  )  [inline]


Member Function Documentation

void StStringList::init (  )  [private]

Reimplemented from StValueList< StString >.

StString StStringList::join ( const StString glue  ) 

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] == ""


The documentation for this class was generated from the following files:
Generated on Tue Nov 14 21:15:10 2006 for Smart Tools Library by  doxygen 1.4.7