Skip to content

dacap/tok

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tok

A minimalist C++ library to iterate through string tokens:

#include <iostream>
#include <string>
#include "tok.h"

int main() {
  // Prints:
  // "This"
  // "is"
  // "a"
  // "phrase."
  // "Several"
  // "whitespaces"
  // "are"
  // "ignored."
  std::string a = "This is a phrase.   Several whitespaces are ignored.";
  for (auto& tok : tok::split_tokens(a, ' ')) {
    std::cout << "\"" << tok << "\"\n";
  }

  // Prints:
  // "In comma"
  // "separated"
  // ""
  // "values"
  // ""
  // ""
  // "empties are included"
  std::string b = "In comma,separated,,values,,,empties are included";
  for (auto& tok : tok::csv(b)) {
    std::cout << "\"" << tok << "\"\n";
  }
}

About

A minimalist C++ library to iterate through string tokens

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors