aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/StringExtras.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-28 22:32:35 +0000
committerChris Lattner <sabre@nondot.org>2006-11-28 22:32:35 +0000
commitd5b58c239e44fe4fa2322900b26c691f5a44bd87 (patch)
tree8782572c65636e039672babf21c9ce952a850532 /lib/Support/StringExtras.cpp
parent30579799eda1763201568722dfe1a19dddf3f49f (diff)
downloadexternal_llvm-d5b58c239e44fe4fa2322900b26c691f5a44bd87.zip
external_llvm-d5b58c239e44fe4fa2322900b26c691f5a44bd87.tar.gz
external_llvm-d5b58c239e44fe4fa2322900b26c691f5a44bd87.tar.bz2
Add a helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/StringExtras.cpp')
-rw-r--r--lib/Support/StringExtras.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Support/StringExtras.cpp b/lib/Support/StringExtras.cpp
index 8ce3715..2ce2349 100644
--- a/lib/Support/StringExtras.cpp
+++ b/lib/Support/StringExtras.cpp
@@ -42,6 +42,21 @@ std::string llvm::getToken(std::string &Source, const char *Delimiters) {
return Result;
}
+/// SplitString - Split up the specified string according to the specified
+/// delimiters, appending the result fragments to the output list.
+void llvm::SplitString(const std::string &Source,
+ std::vector<std::string> &OutFragments,
+ const char *Delimiters) {
+ std::string S = Source;
+
+ std::string S2 = getToken(S, Delimiters);
+ while (!S2.empty()) {
+ OutFragments.push_back(S2);
+ S2 = getToken(S, Delimiters);
+ }
+}
+
+
/// UnescapeString - Modify the argument string, turning two character sequences
/// like '\\' 'n' into '\n'. This handles: \e \a \b \f \n \r \t \v \' \\ and