19 #ifndef PAGESPEED_KERNEL_BASE_STRING_UTIL_H_
20 #define PAGESPEED_KERNEL_BASE_STRING_UTIL_H_
28 #include "base/logging.h"
35 #include "base/strings/string_number_conversions.h"
36 #include "base/strings/string_piece.h"
37 #include "base/strings/string_util.h"
38 #include "base/strings/stringprintf.h"
40 using base::StringAppendF;
41 using base::StringAppendV;
42 using base::SStringPrintf;
43 using base::StringPiece;
44 using base::StringPrintf;
46 typedef StringPiece::size_type stringpiece_ssize_type;
49 inline bool StartsWith(StringPiece a, StringPiece b) {
50 return a.starts_with(b);
52 inline bool EndsWith(StringPiece a, StringPiece b) {
53 return a.ends_with(b);
60 #define STATIC_STRLEN(static_string) (arraysize(static_string) - 1)
62 namespace net_instaweb {
64 struct StringCompareInsensitive;
66 typedef std::map<GoogleString, GoogleString> StringStringMap;
67 typedef std::map<GoogleString, int> StringIntMap;
68 typedef std::set<GoogleString> StringSet;
69 typedef std::set<GoogleString, StringCompareInsensitive> StringSetInsensitive;
70 typedef std::vector<GoogleString> StringVector;
71 typedef std::vector<StringPiece> StringPieceVector;
72 typedef std::vector<const GoogleString*> ConstStringStarVector;
73 typedef std::vector<GoogleString*> StringStarVector;
74 typedef std::vector<const char*> CharStarVector;
77 return base::IntToString(i);
81 return base::UintToString(i);
85 return base::Int64ToString(i);
89 return StringPrintf(
"%p", pointer);
95 return base::StringToInt(in, out);
98 inline bool StringToInt64(
const char* in, int64* out) {
99 return base::StringToInt64(in, out);
103 return base::StringToInt(in, out);
106 inline bool StringToInt64(
const GoogleString& in, int64* out) {
107 return base::StringToInt64(in, out);
117 const char* in_c_str = in.c_str();
118 if (strlen(in_c_str) != in.size()) {
136 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c);
137 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d);
138 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
140 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
141 StringPiece e, StringPiece f);
142 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
143 StringPiece e, StringPiece f, StringPiece g);
144 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
145 StringPiece e, StringPiece f, StringPiece g, StringPiece h);
146 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
147 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
149 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
150 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
151 StringPiece i, StringPiece j);
152 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
153 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
154 StringPiece i, StringPiece j);
155 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
156 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
157 StringPiece i, StringPiece j, StringPiece k);
158 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
159 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
160 StringPiece i, StringPiece j, StringPiece k, StringPiece l);
161 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
162 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
163 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
165 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
166 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
167 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
168 StringPiece m, StringPiece n);
169 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
170 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
171 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
172 StringPiece m, StringPiece n, StringPiece o);
173 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
174 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
175 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
176 StringPiece m, StringPiece n, StringPiece o, StringPiece p);
177 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
178 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
179 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
180 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
182 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
183 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
184 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
185 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
186 StringPiece q, StringPiece r);
187 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
188 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
189 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
190 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
191 StringPiece q, StringPiece r, StringPiece s);
192 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
193 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
194 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
195 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
196 StringPiece q, StringPiece r, StringPiece s, StringPiece t);
197 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
198 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
199 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
200 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
201 StringPiece q, StringPiece r, StringPiece s, StringPiece t,
203 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
204 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
205 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
206 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
207 StringPiece q, StringPiece r, StringPiece s, StringPiece t,
208 StringPiece u, StringPiece v);
209 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
210 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
211 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
212 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
213 StringPiece q, StringPiece r, StringPiece s, StringPiece t,
214 StringPiece u, StringPiece v, StringPiece w);
215 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
216 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
217 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
218 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
219 StringPiece q, StringPiece r, StringPiece s, StringPiece t,
220 StringPiece u, StringPiece v, StringPiece w, StringPiece x);
221 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
222 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
223 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
224 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
225 StringPiece q, StringPiece r, StringPiece s, StringPiece t,
226 StringPiece u, StringPiece v, StringPiece w, StringPiece x,
228 GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c, StringPiece d,
229 StringPiece e, StringPiece f, StringPiece g, StringPiece h,
230 StringPiece i, StringPiece j, StringPiece k, StringPiece l,
231 StringPiece m, StringPiece n, StringPiece o, StringPiece p,
232 StringPiece q, StringPiece r, StringPiece s, StringPiece t,
233 StringPiece u, StringPiece v, StringPiece w, StringPiece x,
234 StringPiece y, StringPiece z);
239 GoogleString StrCatNineOrMore(
const StringPiece* a1, ...);
244 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
245 StringPiece d, StringPiece e, StringPiece f,
246 StringPiece g, StringPiece h, StringPiece i) {
247 const StringPiece* null_stringpiece = NULL;
248 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i,
252 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
253 StringPiece d, StringPiece e, StringPiece f,
254 StringPiece g, StringPiece h, StringPiece i,
256 const StringPiece* null_stringpiece = NULL;
257 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j,
261 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
262 StringPiece d, StringPiece e, StringPiece f,
263 StringPiece g, StringPiece h, StringPiece i,
264 StringPiece j, StringPiece k) {
265 const StringPiece* null_stringpiece = NULL;
266 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
270 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
271 StringPiece d, StringPiece e, StringPiece f,
272 StringPiece g, StringPiece h, StringPiece i,
273 StringPiece j, StringPiece k, StringPiece l) {
274 const StringPiece* null_stringpiece = NULL;
275 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
276 &l, null_stringpiece);
279 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
280 StringPiece d, StringPiece e, StringPiece f,
281 StringPiece g, StringPiece h, StringPiece i,
282 StringPiece j, StringPiece k, StringPiece l,
284 const StringPiece* null_stringpiece = NULL;
285 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
286 &l, &m, null_stringpiece);
289 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
290 StringPiece d, StringPiece e, StringPiece f,
291 StringPiece g, StringPiece h, StringPiece i,
292 StringPiece j, StringPiece k, StringPiece l,
293 StringPiece m, StringPiece n) {
294 const StringPiece* null_stringpiece = NULL;
295 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
296 &l, &m, &n, null_stringpiece);
299 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
300 StringPiece d, StringPiece e, StringPiece f,
301 StringPiece g, StringPiece h, StringPiece i,
302 StringPiece j, StringPiece k, StringPiece l,
303 StringPiece m, StringPiece n, StringPiece o) {
304 const StringPiece* null_stringpiece = NULL;
305 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
306 &l, &m, &n, &o, null_stringpiece);
309 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
310 StringPiece d, StringPiece e, StringPiece f,
311 StringPiece g, StringPiece h, StringPiece i,
312 StringPiece j, StringPiece k, StringPiece l,
313 StringPiece m, StringPiece n, StringPiece o,
315 const StringPiece* null_stringpiece = NULL;
316 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
317 &l, &m, &n, &o, &p, null_stringpiece);
320 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
321 StringPiece d, StringPiece e, StringPiece f,
322 StringPiece g, StringPiece h, StringPiece i,
323 StringPiece j, StringPiece k, StringPiece l,
324 StringPiece m, StringPiece n, StringPiece o,
325 StringPiece p, StringPiece q) {
326 const StringPiece* null_stringpiece = NULL;
327 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
328 &l, &m, &n, &o, &p, &q, null_stringpiece);
331 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
332 StringPiece d, StringPiece e, StringPiece f,
333 StringPiece g, StringPiece h, StringPiece i,
334 StringPiece j, StringPiece k, StringPiece l,
335 StringPiece m, StringPiece n, StringPiece o,
336 StringPiece p, StringPiece q, StringPiece r) {
337 const StringPiece* null_stringpiece = NULL;
338 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
339 &l, &m, &n, &o, &p, &q, &r,
343 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
344 StringPiece d, StringPiece e, StringPiece f,
345 StringPiece g, StringPiece h, StringPiece i,
346 StringPiece j, StringPiece k, StringPiece l,
347 StringPiece m, StringPiece n, StringPiece o,
348 StringPiece p, StringPiece q, StringPiece r,
350 const StringPiece* null_stringpiece = NULL;
351 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
352 &l, &m, &n, &o, &p, &q, &r, &s,
356 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
357 StringPiece d, StringPiece e, StringPiece f,
358 StringPiece g, StringPiece h, StringPiece i,
359 StringPiece j, StringPiece k, StringPiece l,
360 StringPiece m, StringPiece n, StringPiece o,
361 StringPiece p, StringPiece q, StringPiece r,
362 StringPiece s, StringPiece t) {
363 const StringPiece* null_stringpiece = NULL;
364 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
365 &l, &m, &n, &o, &p, &q, &r, &s, &t,
369 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
370 StringPiece d, StringPiece e, StringPiece f,
371 StringPiece g, StringPiece h, StringPiece i,
372 StringPiece j, StringPiece k, StringPiece l,
373 StringPiece m, StringPiece n, StringPiece o,
374 StringPiece p, StringPiece q, StringPiece r,
375 StringPiece s, StringPiece t, StringPiece u) {
376 const StringPiece* null_stringpiece = NULL;
377 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
378 &l, &m, &n, &o, &p, &q, &r, &s, &t, &u,
382 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
383 StringPiece d, StringPiece e, StringPiece f,
384 StringPiece g, StringPiece h, StringPiece i,
385 StringPiece j, StringPiece k, StringPiece l,
386 StringPiece m, StringPiece n, StringPiece o,
387 StringPiece p, StringPiece q, StringPiece r,
388 StringPiece s, StringPiece t, StringPiece u,
390 const StringPiece* null_stringpiece = NULL;
391 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
392 &l, &m, &n, &o, &p, &q, &r, &s, &t, &u, &v,
396 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
397 StringPiece d, StringPiece e, StringPiece f,
398 StringPiece g, StringPiece h, StringPiece i,
399 StringPiece j, StringPiece k, StringPiece l,
400 StringPiece m, StringPiece n, StringPiece o,
401 StringPiece p, StringPiece q, StringPiece r,
402 StringPiece s, StringPiece t, StringPiece u,
403 StringPiece v, StringPiece w) {
404 const StringPiece* null_stringpiece = NULL;
405 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
406 &l, &m, &n, &o, &p, &q, &r, &s, &t, &u, &v,
407 &w, null_stringpiece);
410 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
411 StringPiece d, StringPiece e, StringPiece f,
412 StringPiece g, StringPiece h, StringPiece i,
413 StringPiece j, StringPiece k, StringPiece l,
414 StringPiece m, StringPiece n, StringPiece o,
415 StringPiece p, StringPiece q, StringPiece r,
416 StringPiece s, StringPiece t, StringPiece u,
417 StringPiece v, StringPiece w, StringPiece x) {
418 const StringPiece* null_stringpiece = NULL;
419 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
420 &l, &m, &n, &o, &p, &q, &r, &s, &t, &u, &v,
421 &w, &x, null_stringpiece);
425 StringPiece a, StringPiece b, StringPiece c, StringPiece d, StringPiece e,
426 StringPiece f, StringPiece g, StringPiece h, StringPiece i, StringPiece j,
427 StringPiece k, StringPiece l, StringPiece m, StringPiece n, StringPiece o,
428 StringPiece p, StringPiece q, StringPiece r, StringPiece s, StringPiece t,
429 StringPiece u, StringPiece v, StringPiece w, StringPiece x, StringPiece y) {
430 const StringPiece* null_stringpiece = NULL;
431 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
432 &l, &m, &n, &o, &p, &q, &r, &s, &t, &u, &v,
433 &w, &x, &y, null_stringpiece);
436 inline GoogleString StrCat(StringPiece a, StringPiece b, StringPiece c,
437 StringPiece d, StringPiece e, StringPiece f,
438 StringPiece g, StringPiece h, StringPiece i,
439 StringPiece j, StringPiece k, StringPiece l,
440 StringPiece m, StringPiece n, StringPiece o,
441 StringPiece p, StringPiece q, StringPiece r,
442 StringPiece s, StringPiece t, StringPiece u,
443 StringPiece v, StringPiece w, StringPiece x,
444 StringPiece y, StringPiece z) {
445 const StringPiece* null_stringpiece = NULL;
446 return internal::StrCatNineOrMore(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k,
447 &l, &m, &n, &o, &p, &q, &r, &s, &t, &u, &v,
448 &w, &x, &y, &z, null_stringpiece);
451 inline void StrAppend(
GoogleString* target, StringPiece a) {
452 a.AppendToString(target);
454 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b);
455 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
457 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
458 StringPiece c, StringPiece d);
459 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
460 StringPiece c, StringPiece d, StringPiece e);
461 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
462 StringPiece c, StringPiece d, StringPiece e, StringPiece f);
463 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
464 StringPiece c, StringPiece d, StringPiece e, StringPiece f,
466 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
467 StringPiece c, StringPiece d, StringPiece e, StringPiece f,
468 StringPiece g, StringPiece h);
469 void StrAppend(
GoogleString* target, StringPiece a, StringPiece b,
470 StringPiece c, StringPiece d, StringPiece e, StringPiece f,
471 StringPiece g, StringPiece h, StringPiece i);
476 StringPieceVector* components,
477 bool omit_empty_strings);
482 StringPieceVector* result);
484 void BackslashEscape(StringPiece src, StringPiece to_escape,
500 return ContainsOnlyWhitespaceASCII(str);
513 stringpiece_ssize_type
FindIgnoreCase(StringPiece haystack, StringPiece needle);
536 if ((c >=
'a') && (c <=
'z')) {
545 if ((c >=
'A') && (c <=
'Z')) {
557 return (c ==
' ') || (c ==
'\t') || (c ==
'\r') || (c ==
'\n') || (c ==
'\f');
560 inline char* strdup(
const char* str) {
561 return base::strdup(str);
571 return (((ch >=
'a') && (ch <=
'z')) ||
572 ((ch >=
'A') && (ch <=
'Z')) ||
573 ((ch >=
'0') && (ch <=
'9')));
578 return (
'0' <= c && c <=
'9') ||
579 (
'A' <= c && c <=
'F') ||
580 (
'a' <= c && c <=
'f');
583 inline bool IsDecimalDigit(
char c) {
584 return (c >=
'0' && c <=
'9');
608 DCHECK((in.data() < output->data()) ||
609 (in.data() >= (output->data() + output->length())))
610 <<
"Illegal argument aliasing in TrimWhitespace";
611 StringPiece temp(in);
613 temp.CopyToString(output);
625 bool MemCaseEqual(
const char* s1,
size_t size1,
const char* s2,
size_t size2);
626 inline bool StringCaseEqual(StringPiece s1, StringPiece s2) {
627 return MemCaseEqual(s1.data(), s1.size(), s2.data(), s2.size());
645 bool operator()(
const char* s1,
const char* s2)
const {
651 bool operator()(
const char* s1,
const char* s2)
const {
652 return (strcmp(s1, s2) < 0);
657 bool operator()(StringPiece s1, StringPiece s2)
const {
return s1 < s2; }
661 bool operator()(StringPiece s1, StringPiece s2)
const {
669 std::vector<int>* ints);
673 return strings::EndsWith(path,
"/");
709 size_t size = dest->size();
711 for (I str = start; str != end; ++str) {
712 size += str->size() + sep_size;
713 sep_size = sep.size();
716 StringPiece to_prepend(
"");
717 for (I str = start; str != end; ++str) {
718 StrAppend(dest, to_prepend, *str);
729 GoogleString* dest,
const C& collection, StringPiece sep) {
734 GoogleString JoinCollection(
const C& collection, StringPiece sep) {
742 return (b ?
"true" :
"false");
747 return isascii(static_cast<unsigned char>(c));
753 return (
'\x20' <= c) && (c <=
'\x7E');
bool IsAscii(char c)
Using isascii with signed chars is unfortunately undefined.
Definition: string_util.h:746
int GlobalReplaceSubstring(StringPiece substring, StringPiece replacement, GoogleString *s)
void ParseShellLikeString(StringPiece input, std::vector< GoogleString > *output)
bool TrimWhitespace(StringPiece *str)
const char * BoolToString(bool b)
Converts a boolean to string.
Definition: string_util.h:741
bool EndsInSlash(StringPiece path)
Does a path end in slash?
Definition: string_util.h:672
int GlobalEraseBracketedSubstring(StringPiece left, StringPiece right, GoogleString *string)
int CountCharacterMismatches(StringPiece s1, StringPiece s2)
bool HasPrefixString(StringPiece str, StringPiece prefix)
StringPiece PieceAfterEquals(StringPiece piece)
bool IsHexDigit(char c)
Convenience functions.
Definition: string_util.h:577
void SplitStringUsingSubstr(StringPiece full, StringPiece substr, StringPieceVector *result)
void AppendJoinCollection(GoogleString *dest, const C &collection, StringPiece sep)
Definition: string_util.h:728
char LowerChar(char c)
Definition: string_util.h:544
bool StringToInt(const char *in, int *out)
Definition: string_util.h:94
bool TrimTrailingWhitespace(StringPiece *str)
Trims trailing HTML whitespace. Returns true if any whitespace was trimmed.
stringpiece_ssize_type FindIgnoreCase(StringPiece haystack, StringPiece needle)
bool TrimLeadingWhitespace(StringPiece *str)
Trims leading HTML whitespace. Returns true if any whitespace was trimmed.
Definition: string_util.h:644
char IsHtmlSpace(char c)
Definition: string_util.h:556
bool MemCaseEqual(const char *s1, size_t size1, const char *s2, size_t size2)
Return true iff the two strings are equal, ignoring case.
Definition: string_util.h:650
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
bool AccumulateDecimalValue(char c, uint32 *value)
void TrimQuote(StringPiece *str)
In-place removal of leading and trailing quote. Removes whitespace as well.
Definition: string_util.h:660
bool IsAsciiAlphaNumeric(char ch)
Definition: string_util.h:570
bool StringCaseEndsWith(StringPiece str, StringPiece suffix)
Return true iff str ends with suffix, ignoring case.
void EnsureEndsInSlash(GoogleString *dir)
Make sure directory's path ends in '/'.
Definition: string_util.h:677
bool StringEqualConcat(StringPiece str, StringPiece first, StringPiece second)
GoogleString JoinStringStar(const ConstStringStarVector &vector, StringPiece delim)
GoogleString * StringVectorAdd(StringVector *v)
Appends new empty string to a StringVector and returns a pointer to it.
Definition: string_util.h:696
int StringCaseCompare(StringPiece s1, StringPiece s2)
Case-insensitive string comparison that is locale-independent.
bool AccumulateHexValue(char c, uint32 *value)
int CountSubstring(StringPiece text, StringPiece substring)
bool SplitStringPieceToIntegerVector(StringPiece src, StringPiece separators, std::vector< int > *ints)
void AppendJoinIterator(GoogleString *dest, I start, I end, StringPiece sep)
Append string-like objects accessed through an iterator.
Definition: string_util.h:703
bool StringToDouble(const char *in, double *out)
Definition: string_util.h:656
char UpperChar(char c)
Definition: string_util.h:535
void TrimUrlQuotes(StringPiece *str)
bool IsNonControlAscii(char c)
Definition: string_util.h:752
bool StringCaseStartsWith(StringPiece str, StringPiece prefix)
Return true iff str starts with prefix, ignoring case.
void SplitStringPieceToVector(StringPiece sp, StringPiece separators, StringPieceVector *components, bool omit_empty_strings)