February Challenges
Saturday, February 1, 2020
Number of words in a string Mini exercise: count the number of words in a string. bonus points: count the number of characters in each word Note: you can do both in one pass
Short Exercise: Create a function to “bisect” a string given a delimiter: "id=fubar", '=' should return id and fubar. Prototype: std::pair<std::string, std::string> bisect(std::string_view str, char delim); pair can be found in <utility>. string_view instead of string const& allows for use of string literals / C strings without suffering a pointless string allocation.…more