]> git.lyx.org Git - features.git/blobdiff - src/support/lstrings.C
parlist-16-a.diff
[features.git] / src / support / lstrings.C
index 29766f641e10ecd9318df57974fe40e7ae857e28..1a047933fe78e134c0637ca571f7f081084cad95 100644 (file)
@@ -280,30 +280,6 @@ string const ascii_lowercase(string const & a)
 }
 
 
-bool prefixIs(string const & a, char const * pre)
-{
-       lyx::Assert(pre);
-
-       size_t const l = strlen(pre);
-       string::size_type const alen = a.length();
-
-       if (l > alen || a.empty())
-               return false;
-       else {
-#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
-               // Delete this code when the compilers get a bit better.
-               return ::strncmp(a.c_str(), pre, l) == 0;
-#else
-               // This is the code that we really want to use
-               // but until gcc ships with a basic_string that
-               // implements std::string correctly we have to
-               // use the code above.
-               return a.compare(0, l, pre, l) == 0;
-#endif
-       }
-}
-
-
 bool prefixIs(string const & a, string const & pre)
 {
        string::size_type const prelen = pre.length();
@@ -328,31 +304,6 @@ bool suffixIs(string const & a, char c)
 }
 
 
-bool suffixIs(string const & a, char const * suf)
-{
-       lyx::Assert(suf);
-
-       size_t const suflen = strlen(suf);
-       string::size_type const alen = a.length();
-
-       if (suflen > alen)
-               return false;
-       else {
-#if !defined(USE_INCLUDED_STRING) && !defined(STD_STRING_IS_GOOD)
-               // Delete this code when the compilers get a bit better.
-               string tmp(a, alen - suflen);
-               return ::strncmp(tmp.c_str(), suf, suflen) == 0;
-#else
-               // This is the code that we really want to use
-               // but until gcc ships with a basic_string that
-               // implements std::string correctly we have to
-               // use the code above.
-               return a.compare(alen - suflen, suflen, suf) == 0;
-#endif
-       }
-}
-
-
 bool suffixIs(string const & a, string const & suf)
 {
        string::size_type const suflen = suf.length();
@@ -462,23 +413,6 @@ string const subst(string const & a, char oldchar, char newchar)
 }
 
 
-string const subst(string const & a,
-                  char const * oldstr, string const & newstr)
-{
-       lyx::Assert(oldstr);
-
-       string lstr(a);
-       string::size_type i = 0;
-       string::size_type olen = strlen(oldstr);
-       while ((i = lstr.find(oldstr, i)) != string::npos) {
-               lstr.replace(i, olen, newstr);
-               i += newstr.length(); // We need to be sure that we dont
-               // use the same i over and over again.
-       }
-       return lstr;
-}
-
-
 string const subst(string const & a,
                   string const & oldstr, string const & newstr)
 {
@@ -704,7 +638,7 @@ string bformat(string const & fmt, string const & arg1, string const & arg2,
                % STRCONV(arg3) % STRCONV(arg4)).str());
 }
 
-#else 
+#else
 
 string bformat(string const & fmt, string const & arg1)
 {