summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit228bcd3802906488c45f1cbc4c92755c034ab533 (patch)
treef6e3e78e8d3151175c27e80d9289047e52e25d29 /llvm/lib/Support/StringExtras.cpp
parentf52ae7ec72e77d7ca346012cbe566e3ae1d54f8f (diff)
downloadbcm5719-llvm-228bcd3802906488c45f1cbc4c92755c034ab533.tar.gz
bcm5719-llvm-228bcd3802906488c45f1cbc4c92755c034ab533.zip
Add a helper function
llvm-svn: 31981
Diffstat (limited to 'llvm/lib/Support/StringExtras.cpp')
-rw-r--r--llvm/lib/Support/StringExtras.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp
index 8ce371535b6..2ce234970a9 100644
--- a/llvm/lib/Support/StringExtras.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud