Changeset 225


Ignore:
Timestamp:
1999-04-07T10:17:25+12:00 (25 years ago)
Author:
rjmcnab
Message:

Added splits and joins using text_tset.

Location:
trunk/gsdl/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/lib/text_t.cpp

    r175 r225  
    1212/*
    1313   $Log$
     14   Revision 1.9  1999/04/06 22:17:24  rjmcnab
     15   Added splits and joins using text_tset.
     16
    1417   Revision 1.8  1999/02/28 23:14:41  rjmcnab
    1518
     
    305308// split a string with a character
    306309void splitchar (text_t::const_iterator first, text_t::const_iterator last,
     310        unsigned short c, text_tset &outlist)
     311{
     312  outlist.erase(outlist.begin(), outlist.end());
     313
     314  text_t t;
     315
     316  while (first != last)
     317    {
     318      first = getdelimitstr (first, last, c, t);
     319      outlist.insert (t);
     320    }
     321}
     322
     323void splitchar (text_t::const_iterator first, text_t::const_iterator last,
    307324        unsigned short c, text_tlist &outlist)
    308325{
     
    333350
    334351// join a string using a character
     352void joinchar (const text_tset &inlist, unsigned short c, text_t &outtext)
     353{
     354  outtext.clear ();
     355
     356  text_tset::const_iterator here = inlist.begin ();
     357  text_tset::const_iterator end = inlist.end ();
     358  bool first = true;
     359  while (here != end)
     360    {
     361      if (!first) outtext.push_back (c);
     362      first = false;
     363      outtext += *here;
     364      here++;
     365    }
     366}
     367
    335368void joinchar (const text_tlist &inlist, unsigned short c, text_t &outtext)
    336369{
  • trunk/gsdl/lib/text_t.h

    r195 r225  
    213213// split a string with a character
    214214void splitchar (text_t::const_iterator first, text_t::const_iterator last,
     215        unsigned short c, text_tset &outlist);
     216void splitchar (text_t::const_iterator first, text_t::const_iterator last,
    215217        unsigned short c, text_tlist &outlist);
    216218void splitchar (text_t::const_iterator first, text_t::const_iterator last,
     
    218220
    219221// join a string using a character
     222void joinchar (const text_tset &inlist, unsigned short c, text_t &outtext);
    220223void joinchar (const text_tlist &inlist, unsigned short c, text_t &outtext);
    221224void joinchar (const text_tarray &inlist, unsigned short c, text_t &outtext);
Note: See TracChangeset for help on using the changeset viewer.