WPILibC++  2019.3.1
wpi::StringRef Class Reference

StringRef - Represent a constant reference to a string, i.e. More...

#include <StringRef.h>

Inheritance diagram for wpi::StringRef:

## Public Types

using iterator = const char *

using const_iterator = const char *

using size_type = size_t

## Public Member Functions

Iterators
iterator begin () const noexcept

iterator end () const noexcept

const unsigned char * bytes_begin () const noexcept

const unsigned char * bytes_end () const noexcept

iterator_range< const unsigned
char * >
bytes () const noexcept

String Operations
LLVM_ATTRIBUTE_ALWAYS_INLINE
const char *
data () const noexcept
data - Get a pointer to the start of the string (which may not be null terminated). More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
empty () const noexcept
empty - Check if the string is empty.

LLVM_ATTRIBUTE_ALWAYS_INLINE
size_t
size () const noexcept
size - Get the string size.

LLVM_NODISCARD char front () const noexcept
front - Get the first character in the string.

LLVM_NODISCARD char back () const noexcept
back - Get the last character in the string.

template<typename Allocator >
LLVM_NODISCARD StringRef copy (Allocator &A) const

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
equals (StringRef RHS) const noexcept
equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed. More...

LLVM_NODISCARD bool equals_lower (StringRef RHS) const noexcept
equals_lower - Check for string equality, ignoring case.

LLVM_ATTRIBUTE_ALWAYS_INLINE
int
compare (StringRef RHS) const noexcept
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the RHS. More...

LLVM_NODISCARD int compare_lower (StringRef RHS) const noexcept
compare_lower - Compare two strings, ignoring case.

LLVM_NODISCARD int compare_numeric (StringRef RHS) const noexcept
compare_numeric - Compare two strings, treating sequences of digits as numbers. More...

str - Get the contents as an std::string.

Convert the given ASCII string to uppercase.

LLVM_NODISCARD char operator[] (size_t Index) const noexcept

template<typename T >
std::enable_if< std::is_same
< T, std::string >::value,
StringRef >::type &
operator= (T &&Str)=delete
Disallow accidental assignment from a temporary std::string. More...

Type Conversions
operator std::string () const

String Predicates
LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
startswith (StringRef Prefix) const noexcept
Check if this string starts with the given Prefix.

LLVM_NODISCARD bool startswith_lower (StringRef Prefix) const noexcept
Check if this string starts with the given Prefix, ignoring case.

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
endswith (StringRef Suffix) const noexcept
Check if this string ends with the given Suffix.

LLVM_NODISCARD bool endswith_lower (StringRef Suffix) const noexcept
Check if this string ends with the given Suffix, ignoring case.

String Searching
LLVM_ATTRIBUTE_ALWAYS_INLINE
size_t
find (char C, size_t From=0) const noexcept
Search for the first character C in the string. More...

LLVM_NODISCARD size_t find_lower (char C, size_t From=0) const noexcept
Search for the first character C in the string, ignoring case. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
size_t
find_if (function_ref< bool(char)> F, size_t From=0) const noexcept
Search for the first character satisfying the predicate F. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
size_t
find_if_not (function_ref< bool(char)> F, size_t From=0) const noexcept
Search for the first character not satisfying the predicate F. More...

LLVM_NODISCARD size_t find (StringRef Str, size_t From=0) const noexcept
Search for the first string Str in the string. More...

LLVM_NODISCARD size_t find_lower (StringRef Str, size_t From=0) const noexcept
Search for the first string Str in the string, ignoring case. More...

LLVM_NODISCARD size_t rfind (char C, size_t From=npos) const noexcept
Search for the last character C in the string. More...

LLVM_NODISCARD size_t rfind_lower (char C, size_t From=npos) const noexcept
Search for the last character C in the string, ignoring case. More...

LLVM_NODISCARD size_t rfind (StringRef Str) const noexcept
Search for the last string Str in the string. More...

LLVM_NODISCARD size_t rfind_lower (StringRef Str) const noexcept
Search for the last string Str in the string, ignoring case. More...

LLVM_NODISCARD size_t find_first_of (char C, size_t From=0) const noexcept
Find the first character in the string that is C, or npos if not found. More...

LLVM_NODISCARD size_t find_first_of (StringRef Chars, size_t From=0) const noexcept
Find the first character in the string that is in Chars, or npos if not found. More...

LLVM_NODISCARD size_t find_first_not_of (char C, size_t From=0) const noexcept
Find the first character in the string that is not C or npos if not found. More...

LLVM_NODISCARD size_t find_first_not_of (StringRef Chars, size_t From=0) const noexcept
Find the first character in the string that is not in the string Chars, or npos if not found. More...

LLVM_NODISCARD size_t find_last_of (char C, size_t From=npos) const noexcept
Find the last character in the string that is C, or npos if not found. More...

LLVM_NODISCARD size_t find_last_of (StringRef Chars, size_t From=npos) const noexcept
Find the last character in the string that is in C, or npos if not found. More...

LLVM_NODISCARD size_t find_last_not_of (char C, size_t From=npos) const noexcept
Find the last character in the string that is not C, or npos if not found. More...

LLVM_NODISCARD size_t find_last_not_of (StringRef Chars, size_t From=npos) const noexcept
Find the last character in the string that is not in Chars, or npos if not found. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
contains (StringRef Other) const noexcept
Return true if the given string is a substring of *this, and false otherwise. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
contains (char C) const noexcept
Return true if the given character is contained in *this, and false otherwise. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
contains_lower (StringRef Other) const noexcept
Return true if the given string is a substring of *this, and false otherwise. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
bool
contains_lower (char C) const noexcept
Return true if the given character is contained in *this, and false otherwise. More...

LLVM_NODISCARD size_t count (char C) const noexcept
Return the number of occurrences of C in the string.

size_t count (StringRef Str) const noexcept
Return the number of non-overlapped occurrences of Str in the string. More...

template<typename T >
std::enable_if
< std::numeric_limits< T >
::is_signed, bool >::type
getAsInteger (unsigned Radix, T &Result) const noexcept
Parse the current string as an integer of the specified radix. More...

template<typename T >
std::enable_if
<!std::numeric_limits< T >
::is_signed, bool >::type
getAsInteger (unsigned Radix, T &Result) const noexcept

template<typename T >
std::enable_if
< std::numeric_limits< T >
::is_signed, bool >::type
consumeInteger (unsigned Radix, T &Result) noexcept
Parse the current string as an integer of the specified radix. More...

template<typename T >
std::enable_if
<!std::numeric_limits< T >
::is_signed, bool >::type
consumeInteger (unsigned Radix, T &Result) noexcept

Substring Operations
LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
substr (size_t Start, size_t N=npos) const noexcept
Return a reference to the substring from [Start, Start + N). More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
take_front (size_t N=1) const noexcept
Return a StringRef equal to 'this' but with only the first N elements remaining. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
take_back (size_t N=1) const noexcept
Return a StringRef equal to 'this' but with only the last N elements remaining. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
take_while (function_ref< bool(char)> F) const noexcept
Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
take_until (function_ref< bool(char)> F) const noexcept
Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
drop_front (size_t N=1) const noexcept
Return a StringRef equal to 'this' but with the first N elements dropped. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
drop_back (size_t N=1) const noexcept
Return a StringRef equal to 'this' but with the last N elements dropped. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
drop_while (function_ref< bool(char)> F) const noexcept
Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
drop_until (function_ref< bool(char)> F) const noexcept
Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE bool consume_front (StringRef Prefix) noexcept
Returns true if this StringRef has the given prefix and removes that prefix. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE bool consume_back (StringRef Suffix) noexcept
Returns true if this StringRef has the given suffix and removes that suffix. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE
StringRef
slice (size_t Start, size_t End) const noexcept
Return a reference to the substring from [Start, End). More...

< StringRef, StringRef
split (char Separator) const
Split into two substrings around the first occurrence of a separator character. More...

< StringRef, StringRef
split (StringRef Separator) const
Split into two substrings around the first occurrence of a separator string. More...

void split (SmallVectorImpl< StringRef > &A, StringRef Separator, int MaxSplit=-1, bool KeepEmpty=true) const
Split into substrings around the occurrences of a separator string. More...

void split (SmallVectorImpl< StringRef > &A, char Separator, int MaxSplit=-1, bool KeepEmpty=true) const
Split into substrings around the occurrences of a separator character. More...

< StringRef, StringRef
rsplit (char Separator) const
Split into two substrings around the last occurrence of a separator character. More...

LLVM_NODISCARD StringRef ltrim (char Char) const noexcept
Return string with consecutive Char characters starting from the the left removed. More...

LLVM_NODISCARD StringRef ltrim (StringRef Chars=" \t\n\v\f\r") const noexcept
Return string with consecutive characters in Chars starting from the left removed. More...

LLVM_NODISCARD StringRef rtrim (char Char) const noexcept
Return string with consecutive Char characters starting from the right removed. More...

LLVM_NODISCARD StringRef rtrim (StringRef Chars=" \t\n\v\f\r") const noexcept
Return string with consecutive characters in Chars starting from the right removed. More...

LLVM_NODISCARD StringRef trim (char Char) const noexcept
Return string with consecutive Char characters starting from the left and right removed. More...

LLVM_NODISCARD StringRef trim (StringRef Chars=" \t\n\v\f\r") const noexcept
Return string with consecutive characters in Chars starting from the left and right removed. More...

## Static Public Attributes

static const size_t npos = ~size_t(0)

## Constructors

StringRef ()=default
Construct an empty string ref.

StringRef (std::nullptr_t)=delete
Disable conversion from nullptr. More...

LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef (const char *Str)
Construct a string ref from a cstring.

LLVM_ATTRIBUTE_ALWAYS_INLINE
constexpr
StringRef (const char *data, size_t length)
Construct a string ref from a pointer and length.

LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef (const std::string &Str)
Construct a string ref from an std::string.

static StringRef withNullAsEmpty (const char *data)

## Detailed 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.

## Constructor & Destructor Documentation

 wpi::StringRef::StringRef ( std::nullptr_t )
delete

Disable conversion from nullptr.

This prevents things like if (S == nullptr)

## Member Function Documentation

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE int wpi::StringRef::compare ( StringRef RHS ) const
inlinenoexcept

compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less than, equal to, or greater than the RHS.

 LLVM_NODISCARD int wpi::StringRef::compare_numeric ( StringRef RHS ) const
noexcept

compare_numeric - Compare two strings, treating sequences of digits as numbers.

 LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::consume_back ( StringRef Suffix )
inlinenoexcept

Returns true if this StringRef has the given suffix and removes that suffix.

 LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::consume_front ( StringRef Prefix )
inlinenoexcept

Returns true if this StringRef has the given prefix and removes that prefix.

template<typename T >
 std::enable_if::is_signed, bool>::type wpi::StringRef::consumeInteger ( unsigned Radix, T & Result )
inlinenoexcept

Parse the current string as an integer of the specified radix.

If 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.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::contains ( StringRef Other ) const
inlinenoexcept

Return true if the given string is a substring of *this, and false otherwise.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::contains ( char C ) const
inlinenoexcept

Return true if the given character is contained in *this, and false otherwise.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::contains_lower ( StringRef Other ) const
inlinenoexcept

Return true if the given string is a substring of *this, and false otherwise.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::contains_lower ( char C ) const
inlinenoexcept

Return true if the given character is contained in *this, and false otherwise.

 size_t wpi::StringRef::count ( StringRef Str ) const
noexcept

Return the number of non-overlapped occurrences of Str in the string.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char* wpi::StringRef::data ( ) const
inlinenoexcept

data - Get a pointer to the start of the string (which may not be null terminated).

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::drop_back ( size_t N = 1 ) const
inlinenoexcept

Return a StringRef equal to 'this' but with the last N elements dropped.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::drop_front ( size_t N = 1 ) const
inlinenoexcept

Return a StringRef equal to 'this' but with the first N elements dropped.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::drop_until ( function_ref< bool(char)> F ) const
inlinenoexcept

Return a StringRef equal to 'this', but with all characters not satisfying the given predicate dropped from the beginning of the string.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::drop_while ( function_ref< bool(char)> F ) const
inlinenoexcept

Return a StringRef equal to 'this', but with all characters satisfying the given predicate dropped from the beginning of the string.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool wpi::StringRef::equals ( StringRef RHS ) const
inlinenoexcept

equals - Check for string equality, this is more efficient than compare() when the relative ordering of inequal strings isn't needed.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t wpi::StringRef::find ( char C, size_t From = 0 ) const
inlinenoexcept

Search for the first character C in the string.

Returns
The index of the first occurrence of C, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::find ( StringRef Str, size_t From = 0 ) const
noexcept

Search for the first string Str in the string.

Returns
The index of the first occurrence of Str, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::find_first_not_of ( char C, size_t From = 0 ) const
noexcept

Find the first character in the string that is not C or npos if not found.

 LLVM_NODISCARD size_t wpi::StringRef::find_first_not_of ( StringRef Chars, size_t From = 0 ) const
noexcept

Find the first character in the string that is not in the string Chars, or npos if not found.

Complexity: O(size() + Chars.size())

 LLVM_NODISCARD size_t wpi::StringRef::find_first_of ( char C, size_t From = 0 ) const
inlinenoexcept

Find the first character in the string that is C, or npos if not found.

Same as find.

 LLVM_NODISCARD size_t wpi::StringRef::find_first_of ( StringRef Chars, size_t From = 0 ) const
noexcept

Find the first character in the string that is in Chars, or npos if not found.

Complexity: O(size() + Chars.size())

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t wpi::StringRef::find_if ( function_ref< bool(char)> F, size_t From = 0 ) const
inlinenoexcept

Search for the first character satisfying the predicate F.

Returns
The index of the first character satisfying F starting from From, or npos if not found.
 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t wpi::StringRef::find_if_not ( function_ref< bool(char)> F, size_t From = 0 ) const
inlinenoexcept

Search for the first character not satisfying the predicate F.

Returns
The index of the first character not satisfying F starting from From, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::find_last_not_of ( char C, size_t From = npos ) const
noexcept

Find the last character in the string that is not C, or npos if not found.

 LLVM_NODISCARD size_t wpi::StringRef::find_last_not_of ( StringRef Chars, size_t From = npos ) const
noexcept

Find the last character in the string that is not in Chars, or npos if not found.

Complexity: O(size() + Chars.size())

 LLVM_NODISCARD size_t wpi::StringRef::find_last_of ( char C, size_t From = npos ) const
inlinenoexcept

Find the last character in the string that is C, or npos if not found.

 LLVM_NODISCARD size_t wpi::StringRef::find_last_of ( StringRef Chars, size_t From = npos ) const
noexcept

Find the last character in the string that is in C, or npos if not found.

Complexity: O(size() + Chars.size())

 LLVM_NODISCARD size_t wpi::StringRef::find_lower ( char C, size_t From = 0 ) const
noexcept

Search for the first character C in the string, ignoring case.

Returns
The index of the first occurrence of C, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::find_lower ( StringRef Str, size_t From = 0 ) const
noexcept

Search for the first string Str in the string, ignoring case.

Returns
The index of the first occurrence of Str, or npos if not found.
template<typename T >
 std::enable_if::is_signed, bool>::type wpi::StringRef::getAsInteger ( unsigned Radix, T & Result ) const
inlinenoexcept

Parse the current string as an integer of the specified radix.

If 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.

 LLVM_NODISCARD StringRef wpi::StringRef::ltrim ( char Char ) const
inlinenoexcept

Return string with consecutive Char characters starting from the the left removed.

 LLVM_NODISCARD StringRef wpi::StringRef::ltrim ( StringRef Chars = " \t\n\v\f\r" ) const
inlinenoexcept

Return string with consecutive characters in Chars starting from the left removed.

template<typename T >
 std::enable_if::value, StringRef>::type& wpi::StringRef::operator= ( T && Str )
delete

Disallow accidental assignment from a temporary std::string.

The declaration here is extra complicated so that stringRef = {} and stringRef = "abc" continue to select the move assignment operator.

 LLVM_NODISCARD size_t wpi::StringRef::rfind ( char C, size_t From = npos ) const
inlinenoexcept

Search for the last character C in the string.

Returns
The index of the last occurrence of C, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::rfind ( StringRef Str ) const
noexcept

Search for the last string Str in the string.

Returns
The index of the last occurrence of Str, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::rfind_lower ( char C, size_t From = npos ) const
noexcept

Search for the last character C in the string, ignoring case.

Returns
The index of the last occurrence of C, or npos if not found.
 LLVM_NODISCARD size_t wpi::StringRef::rfind_lower ( StringRef Str ) const
noexcept

Search for the last string Str in the string, ignoring case.

Returns
The index of the last occurrence of Str, or npos if not found.
 LLVM_NODISCARD std::pair wpi::StringRef::rsplit ( char Separator ) const
inline

Split into two substrings around the last occurrence of a separator character.

If 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 Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters
 Separator - The character to split on.
Returns
- The split substrings.
 LLVM_NODISCARD StringRef wpi::StringRef::rtrim ( char Char ) const
inlinenoexcept

Return string with consecutive Char characters starting from the right removed.

 LLVM_NODISCARD StringRef wpi::StringRef::rtrim ( StringRef Chars = " \t\n\v\f\r" ) const
inlinenoexcept

Return string with consecutive characters in Chars starting from the right removed.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::slice ( size_t Start, size_t End ) const
inlinenoexcept

Return a reference to the substring from [Start, End).

Parameters
 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. 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 Start) will be returned. If this is less than Start, an empty string will be returned.
 LLVM_NODISCARD std::pair wpi::StringRef::split ( char Separator ) const
inline

Split into two substrings around the first occurrence of a separator character.

If 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 Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters
 Separator The character to split on.
Returns
The split substrings.
 LLVM_NODISCARD std::pair wpi::StringRef::split ( StringRef Separator ) const
inline

Split into two substrings around the first occurrence of a separator string.

If 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 Separator is not in the string, then the result is a pair (LHS, RHS) where (*this == LHS) and (RHS == "").

Parameters
 Separator - The string to split on.
Returns
- The split substrings.
 void wpi::StringRef::split ( SmallVectorImpl< StringRef > & A, StringRef Separator, int MaxSplit = -1, bool KeepEmpty = true ) const

Split into substrings around the occurrences of a separator string.

Each substring is stored in A. If MaxSplit is >= 0, at most MaxSplit splits are done and consequently <= MaxSplit + 1 elements are added to A. If KeepEmpty is false, empty strings are not added to A. They still count when considering MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true

Parameters
 A - Where to put the substrings. Separator - The string to split on. MaxSplit - The maximum number of times the string is split. KeepEmpty - True if empty substring should be added.
 void wpi::StringRef::split ( SmallVectorImpl< StringRef > & A, char Separator, int MaxSplit = -1, bool KeepEmpty = true ) const

Split into substrings around the occurrences of a separator character.

Each substring is stored in A. If MaxSplit is >= 0, at most MaxSplit splits are done and consequently <= MaxSplit + 1 elements are added to A. If KeepEmpty is false, empty strings are not added to A. They still count when considering MaxSplit An useful invariant is that Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true

Parameters
 A - Where to put the substrings. Separator - The string to split on. MaxSplit - The maximum number of times the string is split. KeepEmpty - True if empty substring should be added.
 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::substr ( size_t Start, size_t N = npos ) const
inlinenoexcept

Return a reference to the substring from [Start, Start + N).

Parameters
 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. N 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 Start) will be returned.
 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::take_back ( size_t N = 1 ) const
inlinenoexcept

Return a StringRef equal to 'this' but with only the last N elements remaining.

If N is greater than the length of the string, the entire string is returned.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::take_front ( size_t N = 1 ) const
inlinenoexcept

Return a StringRef equal to 'this' but with only the first N elements remaining.

If N is greater than the length of the string, the entire string is returned.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::take_until ( function_ref< bool(char)> F ) const
inlinenoexcept

Return the longest prefix of 'this' such that no character in the prefix satisfies the given predicate.

 LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef wpi::StringRef::take_while ( function_ref< bool(char)> F ) const
inlinenoexcept

Return the longest prefix of 'this' such that every character in the prefix satisfies the given predicate.

 LLVM_NODISCARD StringRef wpi::StringRef::trim ( char Char ) const
inlinenoexcept

Return string with consecutive Char characters starting from the left and right removed.

 LLVM_NODISCARD StringRef wpi::StringRef::trim ( StringRef Chars = " \t\n\v\f\r" ) const
inlinenoexcept

Return string with consecutive characters in Chars starting from the left and right removed.

The documentation for this class was generated from the following file:
• /var/lib/jenkins/workspace/WPILib/WPILib - Release/arm/wpiutil/src/main/native/include/wpi/StringRef.h