src/base/str.test.cc
/*
 * str.cc's "split_first" and "split_last" fucntions split a string on a
 * character into two parts. "split_first" splits on the first instance of
 * this character and "split_last" splits on the last instance of this
 * character. The character itself is not included in either of the output
 * right-hand side and left-hand side strings. If the character cannot be
 * found in the string then the left-hand side string is equal to the input
 * string and the right-hand side string is empty.
 */
str.cc's "split_first" and "split_last" fucntions split a string on a
character into two parts. "split_first" splits on the first instance of
this character and "split_last" splits on the last instance of this
character. The character itself is not included in either of the output
right-hand side and left-hand side strings. If the character cannot be
found in the string then the left-hand side string is equal to the input
string and the right-hand side string is empty.
str . cc ' s " split_first " and " split_last " fucntions split a string on a character into two parts . " split_first " splits on the first instance of this character and " split_last " splits on the last instance of this character . The character itself is not included in either of the output right - hand side and left - hand side strings . If the character cannot be found in the string then the left - hand side string is equal to the input string and the right - hand side string is empty .
TEST(StrTest, SplitFirst)
{
    std::string val = "abcdefg abcdefg";
    std::string lhs;
    std::string rhs;
    split_first(val , lhs, rhs, 'f');
    EXPECT_EQ("abcdefg abcdefg", val);
    EXPECT_EQ("abcde", lhs);
    EXPECT_EQ("g abcdefg", rhs);
}
TEST ( StrTest , SplitFirst ) { std :: string val = " " ; std :: string lhs ; std :: string rhs ; split_first ( val , lhs , rhs , ' ' ) ; EXPECT_EQ ( " " , val ) ; EXPECT_EQ ( " " , lhs ) ; EXPECT_EQ ( " " , rhs ) ; }
str.cc's "split_first" and "split_last" fucntions split a string on a
 character into two parts.
str . cc ' s " split_first " and " split_last " fucntions split a string on a character into two parts .