class StringRef
Declaration
class StringRef { /* full declaration omitted */ };
Description
StringRef - Represent a constant reference to a string, i.e. a character array and a length, which need not be null terminated. This class does not own the string data, it is expected to be used in situations where the character data resides in some other buffer, whose lifetime extends past that of the StringRef. For this reason, it is not in general safe to store a StringRef.
Declared at: llvm/include/llvm/ADT/StringRef.h:54
Member Variables
- public static const size_t npos = ~unsigned long(0)
Method Overview
- public StringRef(std::nullptr_t)
- public constexpr StringRef(const char * Str)
- public constexpr StringRef(const char * data, size_t length)
- public StringRef(const std::string & Str)
- public StringRef()
- public char back() const
- public llvm::StringRef::iterator begin() const
- public iterator_range<const unsigned char *> bytes() const
- public const unsigned char * bytes_begin() const
- public const unsigned char * bytes_end() const
- public int compare(llvm::StringRef RHS) const
- public int compare_lower(llvm::StringRef RHS) const
- public int compare_numeric(llvm::StringRef RHS) const
- public template <typename T>typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type consumeInteger(unsigned int Radix, T & Result)
- public template <typename T>typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type consumeInteger(unsigned int Radix, T & Result)
- public bool consume_back(llvm::StringRef Suffix)
- public bool consume_front(llvm::StringRef Prefix)
- public bool contains(llvm::StringRef Other) const
- public bool contains(char C) const
- public bool contains_lower(llvm::StringRef Other) const
- public bool contains_lower(char C) const
- public template <typename Allocator>llvm::StringRef copy(Allocator & A) const
- public size_t count(char C) const
- public size_t count(llvm::StringRef Str) const
- public const char * data() const
- public llvm::StringRef drop_back(size_t N = 1) const
- public llvm::StringRef drop_front(size_t N = 1) const
- public llvm::StringRef drop_until(function_ref<bool (char)> F) const
- public llvm::StringRef drop_while(function_ref<bool (char)> F) const
- public unsigned int edit_distance(llvm::StringRef Other, bool AllowReplacements = true, unsigned int MaxEditDistance = 0) const
- public bool empty() const
- public llvm::StringRef::iterator end() const
- public bool endswith(llvm::StringRef Suffix) const
- public bool endswith_lower(llvm::StringRef Suffix) const
- public bool equals(llvm::StringRef RHS) const
- public bool equals_lower(llvm::StringRef RHS) const
- public size_t find(char C, size_t From = 0) const
- public size_t find(llvm::StringRef Str, size_t From = 0) const
- public size_t find_first_not_of(char C, size_t From = 0) const
- public size_t find_first_not_of(llvm::StringRef Chars, size_t From = 0) const
- public size_t find_first_of(char C, size_t From = 0) const
- public size_t find_first_of(llvm::StringRef Chars, size_t From = 0) const
- public size_t find_if(function_ref<bool (char)> F, size_t From = 0) const
- public size_t find_if_not(function_ref<bool (char)> F, size_t From = 0) const
- public size_t find_last_not_of(char C, size_t From = npos) const
- public size_t find_last_not_of(llvm::StringRef Chars, size_t From = npos) const
- public size_t find_last_of(char C, size_t From = npos) const
- public size_t find_last_of(llvm::StringRef Chars, size_t From = npos) const
- public size_t find_lower(llvm::StringRef Str, size_t From = 0) const
- public size_t find_lower(char C, size_t From = 0) const
- public char front() const
- public bool getAsDouble(double & Result, bool AllowInexact = true) const
- public bool getAsInteger(unsigned int Radix, llvm::APInt & Result) const
- public template <typename T>typename std::enable_if<std::numeric_limits<T>::is_signed, bool>::type getAsInteger(unsigned int Radix, T & Result) const
- public template <typename T>typename std::enable_if<!std::numeric_limits<T>::is_signed, bool>::type getAsInteger(unsigned int Radix, T & Result) const
- public std::string lower() const
- public llvm::StringRef ltrim(llvm::StringRef Chars = " \t\n\v\f\r") const
- public llvm::StringRef ltrim(char Char) const
- public std::string operator basic_string() const
- public size_t rfind(llvm::StringRef Str) const
- public size_t rfind(char C, size_t From = npos) const
- public size_t rfind_lower(char C, size_t From = npos) const
- public size_t rfind_lower(llvm::StringRef Str) const
- public std::pair<StringRef, StringRef> rsplit(char Separator) const
- public std::pair<StringRef, StringRef> rsplit(llvm::StringRef Separator) const
- public llvm::StringRef rtrim(llvm::StringRef Chars = " \t\n\v\f\r") const
- public llvm::StringRef rtrim(char Char) const
- public size_t size() const
- public llvm::StringRef slice(size_t Start, size_t End) const
- public std::pair<StringRef, StringRef> split(char Separator) const
- public std::pair<StringRef, StringRef> split(llvm::StringRef Separator) const
- public void split(SmallVectorImpl<llvm::StringRef> & A, llvm::StringRef Separator, int MaxSplit = -1, bool KeepEmpty = true) const
- public void split(SmallVectorImpl<llvm::StringRef> & A, char Separator, int MaxSplit = -1, bool KeepEmpty = true) const
- public bool startswith(llvm::StringRef Prefix) const
- public bool startswith_lower(llvm::StringRef Prefix) const
- public std::string str() const
- public llvm::StringRef substr(size_t Start, size_t N = npos) const
- public llvm::StringRef take_back(size_t N = 1) const
- public llvm::StringRef take_front(size_t N = 1) const
- public llvm::StringRef take_until(function_ref<bool (char)> F) const
- public llvm::StringRef take_while(function_ref<bool (char)> F) const
- public llvm::StringRef trim(llvm::StringRef Chars = " \t\n\v\f\r") const
- public llvm::StringRef trim(char Char) const
- public std::string upper() const
- public static llvm::StringRef withNullAsEmpty(const char * data)
Methods
¶StringRef(std::nullptr_t)
StringRef(std::nullptr_t)
Description
Disable conversion from nullptr. This prevents things like if (S == nullptr)
Declared at: llvm/include/llvm/ADT/StringRef.h:100
Parameters
¶constexpr StringRef(const char* Str)
constexpr StringRef(const char* Str)
Description
Construct a string ref from a cstring.
Declared at: llvm/include/llvm/ADT/StringRef.h:103
Parameters
- const char* Str
¶constexpr StringRef(const char* data,
size_t length)
constexpr StringRef(const char* data,
size_t length)
Description
Construct a string ref from a pointer and length.
Declared at: llvm/include/llvm/ADT/StringRef.h:107
Parameters
- const char* data
- size_t length
¶StringRef(const std::string& Str)
StringRef(const std::string& Str)
Description
Construct a string ref from an std::string.
Declared at: llvm/include/llvm/ADT/StringRef.h:111
Parameters
- const std::string& Str
¶StringRef()
StringRef()
Description
Construct an empty string ref.
Declared at: llvm/include/llvm/ADT/StringRef.h:96
¶char back() const
char back() const
Description
back - Get the last character in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:162
¶llvm::StringRef::iterator begin() const
llvm::StringRef::iterator begin() const
Description
@ } @ {
Declared at: llvm/include/llvm/ADT/StringRef.h:122
¶iterator_range<const unsigned char*> bytes() const
iterator_range<const unsigned char*> bytes() const
Declared at: llvm/include/llvm/ADT/StringRef.h:132
¶const unsigned char* bytes_begin() const
const unsigned char* bytes_begin() const
Declared at: llvm/include/llvm/ADT/StringRef.h:126
¶const unsigned char* bytes_end() const
const unsigned char* bytes_end() const
Declared at: llvm/include/llvm/ADT/StringRef.h:129
¶int compare(llvm::StringRef RHS) const
int compare(llvm::StringRef RHS) const
Description
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the \p RHS.
Declared at: llvm/include/llvm/ADT/StringRef.h:195
Parameters
- llvm::StringRef RHS
¶int compare_lower(llvm::StringRef RHS) const
int compare_lower(llvm::StringRef RHS) const
Description
compare_lower - Compare two strings, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:208
Parameters
- llvm::StringRef RHS
¶int compare_numeric(llvm::StringRef RHS) const
int compare_numeric(llvm::StringRef RHS) const
Description
compare_numeric - Compare two strings, treating sequences of digits as numbers.
Declared at: llvm/include/llvm/ADT/StringRef.h:213
Parameters
- llvm::StringRef RHS
¶template <typename T>
typename std::enable_if<
!std::numeric_limits<T>::is_signed,
bool>::type
consumeInteger(unsigned int Radix, T& Result)
template <typename T>
typename std::enable_if<
!std::numeric_limits<T>::is_signed,
bool>::type
consumeInteger(unsigned int Radix, T& Result)
Declared at: llvm/include/llvm/ADT/StringRef.h:544
Templates
- T
Parameters
- unsigned int Radix
- T& Result
¶template <typename T>
typename std::enable_if<
std::numeric_limits<T>::is_signed,
bool>::type
consumeInteger(unsigned int Radix, T& Result)
template <typename T>
typename std::enable_if<
std::numeric_limits<T>::is_signed,
bool>::type
consumeInteger(unsigned int Radix, T& Result)
Description
Parse the current string as an integer of the specified radix. If\p Radix is specified as zero, this does radix autosensing using extended C rules: 0 is octal, 0x is hex, 0b is binary. If the string does not begin with a number of the specified radix, this returns true to signify the error. The string is considered erroneous if empty or if it overflows T. The portion of the string representing the discovered numeric value is removed from the beginning of the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:533
Templates
- T
Parameters
- unsigned int Radix
- T& Result
¶bool consume_back(llvm::StringRef Suffix)
bool consume_back(llvm::StringRef Suffix)
Description
Returns true if this StringRef has the given suffix and removes that suffix.
Declared at: llvm/include/llvm/ADT/StringRef.h:681
Parameters
- llvm::StringRef Suffix
¶bool consume_front(llvm::StringRef Prefix)
bool consume_front(llvm::StringRef Prefix)
Description
Returns true if this StringRef has the given prefix and removes that prefix.
Declared at: llvm/include/llvm/ADT/StringRef.h:671
Parameters
- llvm::StringRef Prefix
¶bool contains(llvm::StringRef Other) const
bool contains(llvm::StringRef Other) const
Description
Return true if the given string is a substring of *this, and false otherwise.
Declared at: llvm/include/llvm/ADT/StringRef.h:453
Parameters
- llvm::StringRef Other
¶bool contains(char C) const
bool contains(char C) const
Description
Return true if the given character is contained in *this, and false otherwise.
Declared at: llvm/include/llvm/ADT/StringRef.h:458
Parameters
- char C
¶bool contains_lower(llvm::StringRef Other) const
bool contains_lower(llvm::StringRef Other) const
Description
Return true if the given string is a substring of *this, and false otherwise.
Declared at: llvm/include/llvm/ADT/StringRef.h:463
Parameters
- llvm::StringRef Other
¶bool contains_lower(char C) const
bool contains_lower(char C) const
Description
Return true if the given character is contained in *this, and false otherwise.
Declared at: llvm/include/llvm/ADT/StringRef.h:470
Parameters
- char C
¶template <typename Allocator>
llvm::StringRef copy(Allocator& A) const
template <typename Allocator>
llvm::StringRef copy(Allocator& A) const
Declared at: llvm/include/llvm/ADT/StringRef.h:169
Templates
- Allocator
Parameters
- Allocator& A
¶size_t count(char C) const
size_t count(char C) const
Description
Return the number of occurrences of \p C in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:478
Parameters
- char C
¶size_t count(llvm::StringRef Str) const
size_t count(llvm::StringRef Str) const
Description
Return the number of non-overlapped occurrences of \p Str in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:488
Parameters
- llvm::StringRef Str
¶const char* data() const
const char* data() const
Description
data - Get a pointer to the start of the string (which may not be null terminated).
Declared at: llvm/include/llvm/ADT/StringRef.h:143
¶llvm::StringRef drop_back(size_t N = 1) const
llvm::StringRef drop_back(size_t N = 1) const
Description
Return a StringRef equal to 'this' but with the last \p N elements dropped.
Declared at: llvm/include/llvm/ADT/StringRef.h:650
Parameters
- size_t N = 1
¶llvm::StringRef drop_front(size_t N = 1) const
llvm::StringRef drop_front(size_t N = 1) const
Description
Return a StringRef equal to 'this' but with the first \p N elements dropped.
Declared at: llvm/include/llvm/ADT/StringRef.h:642
Parameters
- size_t N = 1
¶llvm::StringRef drop_until(
function_ref<bool(char)> F) const
llvm::StringRef drop_until(
function_ref<bool(char)> F) const
Description
Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:665
Parameters
- function_ref<bool(char)> F
¶llvm::StringRef drop_while(
function_ref<bool(char)> F) const
llvm::StringRef drop_while(
function_ref<bool(char)> F) const
Description
Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:658
Parameters
- function_ref<bool(char)> F
¶unsigned int edit_distance(
llvm::StringRef Other,
bool AllowReplacements = true,
unsigned int MaxEditDistance = 0) const
unsigned int edit_distance(
llvm::StringRef Other,
bool AllowReplacements = true,
unsigned int MaxEditDistance = 0) const
Description
Determine the edit distance between this string and another string.
Declared at: llvm/include/llvm/ADT/StringRef.h:234
Parameters
- llvm::StringRef Other
- the string to compare this string against.
- bool AllowReplacements = true
- whether to allow character replacements (change one character into another) as a single operation, rather than as two operations (an insertion and a removal).
- unsigned int MaxEditDistance = 0
- If non-zero, the maximum edit distance that this routine is allowed to compute. If the edit distance will exceed that maximum, returns \c MaxEditDistance+1.
Returns
the minimum number of character insertions, removals, or (if \p AllowReplacements is \c true) replacements needed to transform one of the given strings into the other. If zero, the strings are identical.
¶bool empty() const
bool empty() const
Description
empty - Check if the string is empty.
Declared at: llvm/include/llvm/ADT/StringRef.h:147
¶llvm::StringRef::iterator end() const
llvm::StringRef::iterator end() const
Declared at: llvm/include/llvm/ADT/StringRef.h:124
¶bool endswith(llvm::StringRef Suffix) const
bool endswith(llvm::StringRef Suffix) const
Description
Check if this string ends with the given \p Suffix.
Declared at: llvm/include/llvm/ADT/StringRef.h:288
Parameters
- llvm::StringRef Suffix
¶bool endswith_lower(llvm::StringRef Suffix) const
bool endswith_lower(llvm::StringRef Suffix) const
Description
Check if this string ends with the given \p Suffix, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:295
Parameters
- llvm::StringRef Suffix
¶bool equals(llvm::StringRef RHS) const
bool equals(llvm::StringRef RHS) const
Description
equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed.
Declared at: llvm/include/llvm/ADT/StringRef.h:181
Parameters
- llvm::StringRef RHS
¶bool equals_lower(llvm::StringRef RHS) const
bool equals_lower(llvm::StringRef RHS) const
Description
equals_lower - Check for string equality, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:188
Parameters
- llvm::StringRef RHS
¶size_t find(char C, size_t From = 0) const
size_t find(char C, size_t From = 0) const
Description
Search for the first character \p C in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:306
Parameters
- char C
- size_t From = 0
Returns
The index of the first occurrence of \p C, or npos if not found.
¶size_t find(llvm::StringRef Str,
size_t From = 0) const
size_t find(llvm::StringRef Str,
size_t From = 0) const
Description
Search for the first string \p Str in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:352
Parameters
- llvm::StringRef Str
- size_t From = 0
Returns
The index of the first occurrence of \p Str, or npos if not found.
¶size_t find_first_not_of(char C,
size_t From = 0) const
size_t find_first_not_of(char C,
size_t From = 0) const
Description
Find the first character in the string that is not \p C or npos if not found.
Declared at: llvm/include/llvm/ADT/StringRef.h:415
Parameters
- char C
- size_t From = 0
¶size_t find_first_not_of(llvm::StringRef Chars,
size_t From = 0) const
size_t find_first_not_of(llvm::StringRef Chars,
size_t From = 0) const
Description
Find the first character in the string that is not in the string\p Chars, or npos if not found. Complexity: O(size() + Chars.size())
Declared at: llvm/include/llvm/ADT/StringRef.h:422
Parameters
- llvm::StringRef Chars
- size_t From = 0
¶size_t find_first_of(char C,
size_t From = 0) const
size_t find_first_of(char C,
size_t From = 0) const
Description
Find the first character in the string that is \p C, or npos if not found. Same as find.
Declared at: llvm/include/llvm/ADT/StringRef.h:401
Parameters
- char C
- size_t From = 0
¶size_t find_first_of(llvm::StringRef Chars,
size_t From = 0) const
size_t find_first_of(llvm::StringRef Chars,
size_t From = 0) const
Description
Find the first character in the string that is in \p Chars, or npos if not found. Complexity: O(size() + Chars.size())
Declared at: llvm/include/llvm/ADT/StringRef.h:410
Parameters
- llvm::StringRef Chars
- size_t From = 0
¶size_t find_if(function_ref<bool(char)> F,
size_t From = 0) const
size_t find_if(function_ref<bool(char)> F,
size_t From = 0) const
Description
Search for the first character satisfying the predicate \p F
Declared at: llvm/include/llvm/ADT/StringRef.h:328
Parameters
- function_ref<bool(char)> F
- size_t From = 0
Returns
The index of the first character satisfying \p F starting from\p From, or npos if not found.
¶size_t find_if_not(function_ref<bool(char)> F,
size_t From = 0) const
size_t find_if_not(function_ref<bool(char)> F,
size_t From = 0) const
Description
Search for the first character not satisfying the predicate \p F
Declared at: llvm/include/llvm/ADT/StringRef.h:343
Parameters
- function_ref<bool(char)> F
- size_t From = 0
Returns
The index of the first character not satisfying \p F starting from \p From, or npos if not found.
¶size_t find_last_not_of(char C,
size_t From = npos) const
size_t find_last_not_of(char C,
size_t From = npos) const
Description
Find the last character in the string that is not \p C, or npos if not found.
Declared at: llvm/include/llvm/ADT/StringRef.h:441
Parameters
- char C
- size_t From = npos
¶size_t find_last_not_of(llvm::StringRef Chars,
size_t From = npos) const
size_t find_last_not_of(llvm::StringRef Chars,
size_t From = npos) const
Description
Find the last character in the string that is not in \p Chars, or npos if not found. Complexity: O(size() + Chars.size())
Declared at: llvm/include/llvm/ADT/StringRef.h:448
Parameters
- llvm::StringRef Chars
- size_t From = npos
¶size_t find_last_of(char C,
size_t From = npos) const
size_t find_last_of(char C,
size_t From = npos) const
Description
Find the last character in the string that is \p C, or npos if not found.
Declared at: llvm/include/llvm/ADT/StringRef.h:427
Parameters
- char C
- size_t From = npos
¶size_t find_last_of(llvm::StringRef Chars,
size_t From = npos) const
size_t find_last_of(llvm::StringRef Chars,
size_t From = npos) const
Description
Find the last character in the string that is in \p C, or npos if not found. Complexity: O(size() + Chars.size())
Declared at: llvm/include/llvm/ADT/StringRef.h:436
Parameters
- llvm::StringRef Chars
- size_t From = npos
¶size_t find_lower(llvm::StringRef Str,
size_t From = 0) const
size_t find_lower(llvm::StringRef Str,
size_t From = 0) const
Description
Search for the first string \p Str in the string, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:359
Parameters
- llvm::StringRef Str
- size_t From = 0
Returns
The index of the first occurrence of \p Str, or npos if not found.
¶size_t find_lower(char C, size_t From = 0) const
size_t find_lower(char C, size_t From = 0) const
Description
Search for the first character \p C in the string, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:321
Parameters
- char C
- size_t From = 0
Returns
The index of the first occurrence of \p C, or npos if not found.
¶char front() const
char front() const
Description
front - Get the first character in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:155
¶bool getAsDouble(double& Result,
bool AllowInexact = true) const
bool getAsDouble(double& Result,
bool AllowInexact = true) const
Description
Parse the current string as an IEEE double-precision floating point value. The string must be a well-formed double. If \p AllowInexact is false, the function will fail if the string cannot be represented exactly. Otherwise, the function only fails in case of an overflow or underflow, or an invalid floating point representation.
Declared at: llvm/include/llvm/ADT/StringRef.h:572
Parameters
- double& Result
- bool AllowInexact = true
¶bool getAsInteger(unsigned int Radix,
llvm::APInt& Result) const
bool getAsInteger(unsigned int Radix,
llvm::APInt& Result) const
Description
Parse the current string as an integer of the specified \p Radix, or of an autosensed radix if the \p Radix given is 0. The current value in\p Result is discarded, and the storage is changed to be wide enough to store the parsed integer. APInt::fromString is superficially similar but assumes the string is well-formed in the given radix.
Declared at: llvm/include/llvm/ADT/StringRef.h:563
Parameters
- unsigned int Radix
- llvm::APInt& Result
Returns
true if the string does not solely consist of a valid non-empty number in the appropriate base.
¶template <typename T>
typename std::enable_if<
std::numeric_limits<T>::is_signed,
bool>::type
getAsInteger(unsigned int Radix, T& Result) const
template <typename T>
typename std::enable_if<
std::numeric_limits<T>::is_signed,
bool>::type
getAsInteger(unsigned int Radix, T& Result) const
Description
Parse the current string as an integer of the specified radix. If\p Radix is specified as zero, this does radix autosensing using extended C rules: 0 is octal, 0x is hex, 0b is binary. If the string is invalid or if only a subset of the string is valid, this returns true to signify the error. The string is considered erroneous if empty or if it overflows T.
Declared at: llvm/include/llvm/ADT/StringRef.h:499
Templates
- T
Parameters
- unsigned int Radix
- T& Result
¶template <typename T>
typename std::enable_if<
!std::numeric_limits<T>::is_signed,
bool>::type
getAsInteger(unsigned int Radix, T& Result) const
template <typename T>
typename std::enable_if<
!std::numeric_limits<T>::is_signed,
bool>::type
getAsInteger(unsigned int Radix, T& Result) const
Declared at: llvm/include/llvm/ADT/StringRef.h:510
Templates
- T
Parameters
- unsigned int Radix
- T& Result
¶std::string lower() const
std::string lower() const
Description
@ } @ {
Declared at: llvm/include/llvm/ADT/StringRef.h:580
¶llvm::StringRef ltrim(
llvm::StringRef Chars = " \t\n\v\f\r") const
llvm::StringRef ltrim(
llvm::StringRef Chars = " \t\n\v\f\r") const
Description
Return string with consecutive characters in \p Chars starting from the left removed.
Declared at: llvm/include/llvm/ADT/StringRef.h:818
Parameters
- llvm::StringRef Chars = " \t\n\v\f\r"
¶llvm::StringRef ltrim(char Char) const
llvm::StringRef ltrim(char Char) const
Description
Return string with consecutive \p Char characters starting from the the left removed.
Declared at: llvm/include/llvm/ADT/StringRef.h:811
Parameters
- char Char
¶std::string operator basic_string() const
std::string operator basic_string() const
Description
@ } @ {
Declared at: llvm/include/llvm/ADT/StringRef.h:267
¶size_t rfind(llvm::StringRef Str) const
size_t rfind(llvm::StringRef Str) const
Description
Search for the last string \p Str in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:389
Parameters
- llvm::StringRef Str
Returns
The index of the last occurrence of \p Str, or npos if not found.
¶size_t rfind(char C, size_t From = npos) const
size_t rfind(char C, size_t From = npos) const
Description
Search for the last character \p C in the string.
Declared at: llvm/include/llvm/ADT/StringRef.h:366
Parameters
- char C
- size_t From = npos
Returns
The index of the last occurrence of \p C, or npos if not found.
¶size_t rfind_lower(char C,
size_t From = npos) const
size_t rfind_lower(char C,
size_t From = npos) const
Description
Search for the last character \p C in the string, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:382
Parameters
- char C
- size_t From = npos
Returns
The index of the last occurrence of \p C, or npos if not found.
¶size_t rfind_lower(llvm::StringRef Str) const
size_t rfind_lower(llvm::StringRef Str) const
Description
Search for the last string \p Str in the string, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:396
Parameters
- llvm::StringRef Str
Returns
The index of the last occurrence of \p Str, or npos if not found.
¶std::pair<StringRef, StringRef> rsplit(
char Separator) const
std::pair<StringRef, StringRef> rsplit(
char Separator) const
Description
Split into two substrings around the last occurrence of a separator character. If \p Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is minimal. If \p Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
Declared at: llvm/include/llvm/ADT/StringRef.h:804
Parameters
- char Separator
- - The character to split on.
Returns
- The split substrings.
¶std::pair<StringRef, StringRef> rsplit(
llvm::StringRef Separator) const
std::pair<StringRef, StringRef> rsplit(
llvm::StringRef Separator) const
Description
Split into two substrings around the last occurrence of a separator string. If \p Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is minimal. If \p Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
Declared at: llvm/include/llvm/ADT/StringRef.h:751
Parameters
- llvm::StringRef Separator
- - The string to split on.
Returns
- The split substrings.
¶llvm::StringRef rtrim(
llvm::StringRef Chars = " \t\n\v\f\r") const
llvm::StringRef rtrim(
llvm::StringRef Chars = " \t\n\v\f\r") const
Description
Return string with consecutive characters in \p Chars starting from the right removed.
Declared at: llvm/include/llvm/ADT/StringRef.h:832
Parameters
- llvm::StringRef Chars = " \t\n\v\f\r"
¶llvm::StringRef rtrim(char Char) const
llvm::StringRef rtrim(char Char) const
Description
Return string with consecutive \p Char characters starting from the right removed.
Declared at: llvm/include/llvm/ADT/StringRef.h:825
Parameters
- char Char
¶size_t size() const
size_t size() const
Description
size - Get the string size.
Declared at: llvm/include/llvm/ADT/StringRef.h:151
¶llvm::StringRef slice(size_t Start,
size_t End) const
llvm::StringRef slice(size_t Start,
size_t End) const
Description
Return a reference to the substring from [Start, End).
Declared at: llvm/include/llvm/ADT/StringRef.h:701
Parameters
- size_t Start
- The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
- size_t End
- The index following the last character to include in the substring. If this is npos or exceeds the number of characters remaining in the string, the string suffix (starting with \p Start) will be returned. If this is less than \p Start, an empty string will be returned.
¶std::pair<StringRef, StringRef> split(
char Separator) const
std::pair<StringRef, StringRef> split(
char Separator) const
Description
Split into two substrings around the first occurrence of a separator character. If \p Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is maximal. If \p Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
Declared at: llvm/include/llvm/ADT/StringRef.h:718
Parameters
- char Separator
- The character to split on.
Returns
The split substrings.
¶std::pair<StringRef, StringRef> split(
llvm::StringRef Separator) const
std::pair<StringRef, StringRef> split(
llvm::StringRef Separator) const
Description
Split into two substrings around the first occurrence of a separator string. If \p Separator is in the string, then the result is a pair (LHS, RHS) such that (*this == LHS + Separator + RHS) is true and RHS is maximal. If \p Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").
Declared at: llvm/include/llvm/ADT/StringRef.h:733
Parameters
- llvm::StringRef Separator
- - The string to split on.
Returns
- The split substrings.
¶void split(SmallVectorImpl<llvm::StringRef>& A,
llvm::StringRef Separator,
int MaxSplit = -1,
bool KeepEmpty = true) const
void split(SmallVectorImpl<llvm::StringRef>& A,
llvm::StringRef Separator,
int MaxSplit = -1,
bool KeepEmpty = true) const
Description
Split into substrings around the occurrences of a separator string. Each substring is stored in \p A. If \p MaxSplit is >= 0, at most\p MaxSplit splits are done and consequently < = \p MaxSplit + 1 elements are added to A. If \p KeepEmpty is false, empty strings are not added to \p A. They still count when considering \p MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
Declared at: llvm/include/llvm/ADT/StringRef.h:772
Parameters
- SmallVectorImpl<llvm::StringRef>& A
- - Where to put the substrings.
- llvm::StringRef Separator
- - The string to split on.
- int MaxSplit = -1
- - The maximum number of times the string is split.
- bool KeepEmpty = true
- - True if empty substring should be added.
¶void split(SmallVectorImpl<llvm::StringRef>& A,
char Separator,
int MaxSplit = -1,
bool KeepEmpty = true) const
void split(SmallVectorImpl<llvm::StringRef>& A,
char Separator,
int MaxSplit = -1,
bool KeepEmpty = true) const
Description
Split into substrings around the occurrences of a separator character. Each substring is stored in \p A. If \p MaxSplit is >= 0, at most\p MaxSplit splits are done and consequently < = \p MaxSplit + 1 elements are added to A. If \p KeepEmpty is false, empty strings are not added to \p A. They still count when considering \p MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true
Declared at: llvm/include/llvm/ADT/StringRef.h:790
Parameters
- SmallVectorImpl<llvm::StringRef>& A
- - Where to put the substrings.
- char Separator
- - The string to split on.
- int MaxSplit = -1
- - The maximum number of times the string is split.
- bool KeepEmpty = true
- - True if empty substring should be added.
¶bool startswith(llvm::StringRef Prefix) const
bool startswith(llvm::StringRef Prefix) const
Description
Check if this string starts with the given \p Prefix.
Declared at: llvm/include/llvm/ADT/StringRef.h:277
Parameters
- llvm::StringRef Prefix
¶bool startswith_lower(
llvm::StringRef Prefix) const
bool startswith_lower(
llvm::StringRef Prefix) const
Description
Check if this string starts with the given \p Prefix, ignoring case.
Declared at: llvm/include/llvm/ADT/StringRef.h:284
Parameters
- llvm::StringRef Prefix
¶std::string str() const
std::string str() const
Description
str - Get the contents as an std::string.
Declared at: llvm/include/llvm/ADT/StringRef.h:239
¶llvm::StringRef substr(size_t Start,
size_t N = npos) const
llvm::StringRef substr(size_t Start,
size_t N = npos) const
Description
Return a reference to the substring from [Start, Start + N).
Declared at: llvm/include/llvm/ADT/StringRef.h:600
Parameters
- size_t Start
- The index of the starting character in the substring; if the index is npos or greater than the length of the string then the empty substring will be returned.
- size_t N = npos
- The number of characters to included in the substring. If N exceeds the number of characters remaining in the string, the string suffix (starting with \p Start) will be returned.
¶llvm::StringRef take_back(size_t N = 1) const
llvm::StringRef take_back(size_t N = 1) const
Description
Return a StringRef equal to 'this' but with only the last \p N elements remaining. If \p N is greater than the length of the string, the entire string is returned.
Declared at: llvm/include/llvm/ADT/StringRef.h:619
Parameters
- size_t N = 1
¶llvm::StringRef take_front(size_t N = 1) const
llvm::StringRef take_front(size_t N = 1) const
Description
Return a StringRef equal to 'this' but with only the first \p N elements remaining. If \p N is greater than the length of the string, the entire string is returned.
Declared at: llvm/include/llvm/ADT/StringRef.h:609
Parameters
- size_t N = 1
¶llvm::StringRef take_until(
function_ref<bool(char)> F) const
llvm::StringRef take_until(
function_ref<bool(char)> F) const
Description
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.
Declared at: llvm/include/llvm/ADT/StringRef.h:635
Parameters
- function_ref<bool(char)> F
¶llvm::StringRef take_while(
function_ref<bool(char)> F) const
llvm::StringRef take_while(
function_ref<bool(char)> F) const
Description
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.
Declared at: llvm/include/llvm/ADT/StringRef.h:628
Parameters
- function_ref<bool(char)> F
¶llvm::StringRef trim(
llvm::StringRef Chars = " \t\n\v\f\r") const
llvm::StringRef trim(
llvm::StringRef Chars = " \t\n\v\f\r") const
Description
Return string with consecutive characters in \p Chars starting from the left and right removed.
Declared at: llvm/include/llvm/ADT/StringRef.h:846
Parameters
- llvm::StringRef Chars = " \t\n\v\f\r"
¶llvm::StringRef trim(char Char) const
llvm::StringRef trim(char Char) const
Description
Return string with consecutive \p Char characters starting from the left and right removed.
Declared at: llvm/include/llvm/ADT/StringRef.h:839
Parameters
- char Char
¶std::string upper() const
std::string upper() const
Description
Convert the given ASCII string to uppercase.
Declared at: llvm/include/llvm/ADT/StringRef.h:584
¶static llvm::StringRef withNullAsEmpty(
const char* data)
static llvm::StringRef withNullAsEmpty(
const char* data)
Declared at: llvm/include/llvm/ADT/StringRef.h:114
Parameters
- const char* data