+/**
+ * \brief Replaces all special characters
+ * @param s string to modify
+ * @param rep replacement char
+ */
+void Util::ReplaceSpecChar(std::string &s, std::string &rep)
+{
+ unsigned int s_size = s.size();
+ for(unsigned int i=0; i<s_size; i++)
+ {
+ if (! ( s[i] == '.' || s[i] == '%' || s[i] == '_'
+ || (s[i] >= '+' && s[i] <= '-')
+ || (s[i] >= 'a' && s[i] <= 'z')
+ || (s[i] >= '0' && s[i] <= '9')
+ || (s[i] >= 'A' && s[i] <= 'Z')))
+ {
+ s.replace(i, 1, rep);
+ }
+ }
+ // deal with Dicom strings trailing '\0'
+ if(s[s_size-1] == rep.c_str()[0])
+ s.erase(s_size-1, 1);
+}
+