-static inline std::string itostr(int X) {
- if (X < 0)
- return utostr(static_cast<unsigned>(-X), true);
- else
- return utostr(static_cast<unsigned>(X));
-}
-
-static inline std::string ftostr(double V) {
- char Buffer[200];
- sprintf(Buffer, "%20.6e", V);
- char *B = Buffer;
- while (*B == ' ') ++B;
- return B;
-}
-
-static inline std::string LowercaseString(const std::string &S) {
- std::string result(S);
- for (unsigned i = 0; i < S.length(); ++i)
- if (isupper(result[i]))
- result[i] = char(tolower(result[i]));
- return result;
-}
-
-/// StringsEqualNoCase - Return true if the two strings are equal, ignoring
-/// case.
-static inline bool StringsEqualNoCase(const std::string &LHS,
- const std::string &RHS) {
- if (LHS.size() != RHS.size()) return false;
- for (unsigned i = 0, e = LHS.size(); i != e; ++i)
- if (tolower(LHS[i]) != tolower(RHS[i])) return false;
- return true;
-}
-
-/// StringsEqualNoCase - Return true if the two strings are equal, ignoring
-/// case.
-static inline bool StringsEqualNoCase(const std::string &LHS,
- const char *RHS) {
- for (unsigned i = 0, e = LHS.size(); i != e; ++i) {
- if (RHS[i] == 0) return false; // RHS too short.
- if (tolower(LHS[i]) != tolower(RHS[i])) return false;
- }
- return RHS[LHS.size()] == 0; // Not too long?
-}
+/// StrInStrNoCase - Portable version of strcasestr. Locates the first
+/// occurrence of string 's1' in string 's2', ignoring case. Returns
+/// the offset of s2 in s1 or npos if s2 cannot be found.
+StringRef::size_type StrInStrNoCase(StringRef s1, StringRef s2);