Home | History | Annotate | Download | only in strings

Lines Matching full:string_utils

5 #include <brillo/strings/string_utils.h>
19 parts = string_utils::Split("", ",", false, false);
22 parts = string_utils::Split("abc", ",", false, false);
26 parts = string_utils::Split(",a,bc , d, ,e, ", ",", true, true);
33 parts = string_utils::Split(",a,bc , d, ,e, ", ",", false, true);
42 parts = string_utils::Split(",a,bc , d, ,e, ", ",", true, false);
52 parts = string_utils::Split(",a,bc , d, ,e, ", ",", false, false);
62 parts = string_utils::Split("abc:=xyz", ":=", false, false);
67 parts = string_utils::Split("abc", "", false, false);
77 pair = string_utils::SplitAtFirst(" 123 : 4 : 56 : 789 ", ":", true);
81 pair = string_utils::SplitAtFirst(" 123 : 4 : 56 : 789 ", ":", false);
85 pair = string_utils::SplitAtFirst("", "=");
89 pair = string_utils::SplitAtFirst("=", "=");
93 pair = string_utils::SplitAtFirst("a=", "=");
97 pair = string_utils::SplitAtFirst("abc=", "=");
101 pair = string_utils::SplitAtFirst("=a", "=");
105 pair = string_utils::SplitAtFirst("=abc=", "=");
109 pair = string_utils::SplitAtFirst("abc", "=");
113 pair = string_utils::SplitAtFirst("abc:=xyz", ":=");
117 pair = string_utils::SplitAtFirst("abc", "");
123 EXPECT_EQ("", string_utils::Join(",", {}));
124 EXPECT_EQ("abc", string_utils::Join(",", {"abc"}));
125 EXPECT_EQ("abc,,xyz", string_utils::Join(",", {"abc", "", "xyz"}));
126 EXPECT_EQ("abc,defg", string_utils::Join(",", {"abc", "defg"}));
127 EXPECT_EQ("1 : 2 : 3", string_utils::Join(" : ", {"1", "2", "3"}));
128 EXPECT_EQ("1:2", string_utils::Join(":", std::set<std::string>{"1", "2"}));
129 EXPECT_EQ("1:2", string_utils::Join(":", std::vector<std::string>{"1", "2"}));
130 EXPECT_EQ("1:2", string_utils::Join(":", std::list<std::string>{"1", "2"}));
131 EXPECT_EQ("123", string_utils::Join("", {"1", "2", "3"}));
135 EXPECT_EQ("ab,cd", string_utils::Join(",", "ab", "cd"));
136 EXPECT_EQ("key = value", string_utils::Join(" = ", "key", "value"));
140 EXPECT_EQ("abc", string_utils::GetBytesAsString({'a', 'b', 'c'}));
141 EXPECT_TRUE(string_utils::GetBytesAsString({}).empty());
142 auto str = string_utils::GetBytesAsString({0xFF, 0x00, 0x01, 0x7F, 0x80});
153 string_utils::GetStringAsBytes("abc"));
154 EXPECT_TRUE(string_utils::GetStringAsBytes("").empty());
155 auto buf = string_utils::GetStringAsBytes(std::string{"\x80\0\1\xFF", 4});