File: string_utils.h

package info (click to toggle)
android-platform-frameworks-base 1%3A10.0.0%2Br36-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 321,788 kB
  • sloc: java: 962,234; cpp: 274,314; xml: 242,770; python: 5,060; sh: 1,432; ansic: 494; makefile: 47; sed: 19
file content (45 lines) | stat: -rw-r--r-- 1,017 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <string>
#include <vector>

namespace android {
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.
 */
string to_camel_case(const string& str);

/**
 * Capitalize and insert underscores for CamelCase.
 */
string make_constant_name(const string& str);

/**
 * Returns the part of a file name that isn't a path and isn't a type suffix.
 */
string file_base_name(const string& str);

/**
 * 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 stream_proto
} // namespace android