Created
June 16, 2017 04:20
-
-
Save 2bbb/d06f6d201a83f8910004f0006ba44e56 to your computer and use it in GitHub Desktop.
pipe example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bbb/pipe.hpp> | |
#include <iostream> | |
int main(int argc, char *argv[]) { | |
std::string str = "a/b/cdcd/ezzzf/ghi/azzz/czzzd/ef"; | |
auto res = str | |
| bbb::replace("zzz", "Z") // "a/b/cdcd/eZf/ghi/aZ/cZd/ef" | |
| bbb::split("/") // {"a", "b", "cdcd", "eZf", "ghi", "aZ", "cZd", "ef"} | |
| bbb::filter([](std::string str) { return str.length() < 3; }) // {"a", "b", "aZ", "ef"} | |
| bbb::map([](std::string str) { return str | bbb::reverse(); }) // {"a", "b", "Za", "fe"} | |
| bbb::join(" ") // "a b Za fe" | |
| bbb::reverse(); // "ef aZ b a" | |
std::cout << res << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment