llvm.org GIT mirror llvm / d5b58c2
Add a helper function git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31981 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
2 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1717 #include
1818 #include
1919 #include
20 #include
2021
2122 namespace llvm {
2223
128129 std::string getToken(std::string &Source,
129130 const char *Delimiters = " \t\n\v\f\r");
130131
132 /// SplitString - Split up the specified string according to the specified
133 /// delimiters, appending the result fragments to the output list.
134 void SplitString(const std::string &Source,
135 std::vector &OutFragments,
136 const char *Delimiters = " \t\n\v\f\r");
137
131138 /// UnescapeString - Modify the argument string, turning two character sequences
132139 /// like '\\' 'n' into '\n'. This handles: \e \a \b \f \n \r \t \v \' \\ and
133140 /// \num (where num is a 1-3 byte octal value).
4040
4141 return Result;
4242 }
43
44 /// SplitString - Split up the specified string according to the specified
45 /// delimiters, appending the result fragments to the output list.
46 void llvm::SplitString(const std::string &Source,
47 std::vector &OutFragments,
48 const char *Delimiters) {
49 std::string S = Source;
50
51 std::string S2 = getToken(S, Delimiters);
52 while (!S2.empty()) {
53 OutFragments.push_back(S2);
54 S2 = getToken(S, Delimiters);
55 }
56 }
57
4358
4459
4560 /// UnescapeString - Modify the argument string, turning two character sequences