diff options
Diffstat (limited to 'tools/streaming_proto/string_utils.h')
-rw-r--r-- | tools/streaming_proto/string_utils.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/streaming_proto/string_utils.h b/tools/streaming_proto/string_utils.h index ffe83ca99704..315b27531afd 100644 --- a/tools/streaming_proto/string_utils.h +++ b/tools/streaming_proto/string_utils.h @@ -1,10 +1,14 @@ #include <string> +#include <vector> namespace android { -namespace javastream_proto { +namespace stream_proto { using namespace std; +// Indent +const string INDENT = " "; + /** * Capitalizes the string, removes underscores and makes the next letter * capitalized, and makes the letter following numbers capitalized. @@ -22,11 +26,20 @@ string make_constant_name(const string& str); string file_base_name(const string& str); /** - * Replace all occurances of 'replace' with 'with'. + * Replaces all occurances of 'replace' with 'with'. */ string replace_string(const string& str, const char replace, const char with); +/** + * Splits a string to parts by delimiter. + */ +vector<string> split(const string& str, const char delimiter); + +/** + * Returns the rest of str if it has prefix, otherwise return all. + */ +string stripPrefix(const string& str, const string& prefix); -} // namespace javastream_proto +} // namespace stream_proto } // namespace android |