aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/parsing.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-04-10 22:08:52 +0000
committerlloyd <[email protected]>2013-04-10 22:08:52 +0000
commit56e7e7187985f87037d032b49b6ff3699e7668f7 (patch)
tree241bd86799e2d89374c966c91db35c542a3b577b /src/utils/parsing.h
parentbdb29dfb8acd66c803769238ca4b204839f5da46 (diff)
Add erase_chars and replace_chars
Diffstat (limited to 'src/utils/parsing.h')
-rw-r--r--src/utils/parsing.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/utils/parsing.h b/src/utils/parsing.h
index bdf61a075..88c5a7bc0 100644
--- a/src/utils/parsing.h
+++ b/src/utils/parsing.h
@@ -1,6 +1,6 @@
/*
-* Parser Functions
-* (C) 1999-2007 Jack Lloyd
+* Various string utils and parsing functions
+* (C) 1999-2007,2013 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
@@ -11,6 +11,7 @@
#include <botan/types.h>
#include <string>
#include <vector>
+#include <set>
namespace Botan {
@@ -32,6 +33,11 @@ BOTAN_DLL std::vector<std::string> split_on(
const std::string& str, char delim);
/**
+* Erase characters from a string
+*/
+BOTAN_DLL std::string erase_chars(const std::string& str, const std::set<char>& chars);
+
+/**
* Replace a character in a string
* @param str the input string
* @param from_char the character to replace
@@ -43,6 +49,17 @@ BOTAN_DLL std::string replace_char(const std::string& str,
char to_char);
/**
+* Replace a character in a string
+* @param str the input string
+* @param from_chars the characters to replace
+* @param to_char the character to replace it with
+* @return str with all instances of from_chars replaced by to_char
+*/
+BOTAN_DLL std::string replace_chars(const std::string& str,
+ const std::set<char>& from_chars,
+ char to_char);
+
+/**
* Join a string
* @param strs strings to join
* @param delim the delimitor