OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_GN_STRING_UTILS_H_ | 5 #ifndef TOOLS_GN_STRING_UTILS_H_ |
6 #define TOOLS_GN_STRING_UTILS_H_ | 6 #define TOOLS_GN_STRING_UTILS_H_ |
7 | 7 |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 | 9 |
10 class Err; | 10 class Err; |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Note: could potentially return a StringPiece into the str. | 41 // Note: could potentially return a StringPiece into the str. |
42 std::string RemovePrefix(const std::string& str, const std::string& prefix); | 42 std::string RemovePrefix(const std::string& str, const std::string& prefix); |
43 | 43 |
44 // Appends the given string piece to the given string. This avoids an | 44 // Appends the given string piece to the given string. This avoids an |
45 // intermediate copy. | 45 // intermediate copy. |
46 inline void AppendStringPiece(std::string* dest, | 46 inline void AppendStringPiece(std::string* dest, |
47 const base::StringPiece& piece) { | 47 const base::StringPiece& piece) { |
48 dest->append(piece.data(), piece.size()); | 48 dest->append(piece.data(), piece.size()); |
49 } | 49 } |
50 | 50 |
| 51 // Removes the trailing slash from the given string. This asserts that either |
| 52 // the string is empty or it ends with a slash (normally used to process |
| 53 // directories). |
| 54 void TrimTrailingSlash(std::string* str); |
| 55 |
51 #endif // TOOLS_GN_STRING_UTILS_H_ | 56 #endif // TOOLS_GN_STRING_UTILS_H_ |
OLD | NEW |