Skip to content

Instantly share code, notes, and snippets.

@Fiona-J-W
Created February 17, 2014 01:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Fiona-J-W/9043197 to your computer and use it in GitHub Desktop.
Save Fiona-J-W/9043197 to your computer and use it in GitHub Desktop.
#include <string>
#include <iostream>
int main() {
using std::string;
std::string umlauts_small = u8"äöü";
std::string umlauts_capital = u8"ÄÖÜ";
auto foo = umlauts_small + "|" + umlauts_capital;
// ...
auto middle = std::find(foo.begin(), foo.end(), '|');
std::string part1{foo.begin(), middle}; // "aou"
std::string part2{middle+1, foo.end()}; // „ÄÖÜ“
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment