//===-- StringExtras.cpp - Implement the StringExtras header --------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the StringExtras.h header // //===----------------------------------------------------------------------===// #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/raw_ostream.h" #include <cctype> usingnamespacellvm; /// 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 llvm::StrInStrNoCase(StringRef s1, StringRef s2) { … } /// getToken - This function extracts one token from source, ignoring any /// leading characters that appear in the Delimiters string, and ending the /// token at any of the characters that appear in the Delimiters string. If /// there are no tokens in the source string, an empty string is returned. /// The function returns a pair containing the extracted token and the /// remaining tail string. std::pair<StringRef, StringRef> llvm::getToken(StringRef Source, StringRef Delimiters) { … } /// SplitString - Split up the specified string according to the specified /// delimiters, appending the result fragments to the output list. void llvm::SplitString(StringRef Source, SmallVectorImpl<StringRef> &OutFragments, StringRef Delimiters) { … } void llvm::printEscapedString(StringRef Name, raw_ostream &Out) { … } void llvm::printHTMLEscaped(StringRef String, raw_ostream &Out) { … } void llvm::printLowerCase(StringRef String, raw_ostream &Out) { … } std::string llvm::convertToSnakeFromCamelCase(StringRef input) { … } std::string llvm::convertToCamelFromSnakeCase(StringRef input, bool capitalizeFirst) { … }