Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7212 in orxonox.OLD for branches/std/src/lib/util/substring.cc


Ignore:
Timestamp:
Mar 10, 2006, 5:28:52 AM (19 years ago)
Author:
bensch
Message:

should be better, but hey…. its late

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/lib/util/substring.cc

    r7211 r7212  
    1414
    1515   2005-06-10: some naming conventions
     16
     17//
     18//  splitLine
     19//  STL string tokenizer
     20//
     21//  Created by Clemens Wacha.
     22//  Version 1.0
     23//  Copyright (c) 2005 Clemens Wacha. All rights reserved.
     24//
     25
    1626*/
    1727
     
    3545                       string, split);
    3646}
    37 
    3847
    3948/**
     
    4857                      string);
    4958}
    50 
    5159SubString::SubString(const std::string& string, const std::string& splitters, char escapeChar,char safemode_char, char comment_char)
    5260{
    5361  SubString::splitLine(this->strings, this->offsets,
    5462                       string, splitters, escapeChar, safemode_char);
     63}
     64
     65
     66unsigned int SubString::split(const std::string& string, char splitter)
     67{
     68  this->offsets.clear();
     69  this->strings.clear();
     70  char split[2];
     71  split[0] = splitter;
     72  split[1] = '\0';
     73  SubString::splitLine(this->strings, this->offsets, string, split);
     74  return strings.size();
     75}
     76
     77
     78/**
     79 * Splits a String into a Substring removing all whiteSpaces
     80 * @param string the String to Split
     81 * @param whiteSpaces MUST BE __TRUE__
     82 *
     83 */
     84unsigned int SubString::split(const std::string& string, bool whiteSpaces)
     85{
     86  this->offsets.clear();
     87  this->strings.clear();
     88  SubString::splitLine(this->strings, this->offsets, string);
     89  return strings.size();
     90}
     91
     92unsigned int SubString::split(const std::string& string, const std::string& splitters, char escapeChar,char safemode_char, char comment_char)
     93{
     94  this->offsets.clear();
     95  this->strings.clear();
     96  SubString::splitLine(this->strings, this->offsets,
     97                       string, splitters, escapeChar, safemode_char);
     98  return strings.size();
    5599}
    56100
Note: See TracChangeset for help on using the changeset viewer.