55 template <
typename... OtherElements>
59 StringArray (
const std::initializer_list<const char*>& strings);
65 template <
typename Type>
68 addArray (stringArray.
begin(), stringArray.
end());
82 StringArray (
const char*
const* strings,
int numberOfStrings);
89 explicit StringArray (
const char*
const* strings);
95 explicit StringArray (
const wchar_t*
const* strings);
102 StringArray (
const wchar_t*
const* strings,
int numberOfStrings);
108 StringArray& operator= (
const StringArray&);
111 StringArray& operator= (StringArray&&) noexcept;
114 template <
typename Type>
117 addArray (stringArray.
begin(), stringArray.
end());
122 void swapWith (StringArray&) noexcept;
129 bool operator== (
const StringArray&)
const noexcept;
135 bool operator!= (
const StringArray&)
const noexcept;
139 inline int size() const noexcept {
return strings.size(); }
142 inline bool isEmpty() const noexcept {
return size() == 0; }
151 const String& operator[] (
int index)
const noexcept;
157 String& getReference (
int index) noexcept;
167 inline String*
end() const noexcept {
return strings.end(); }
175 bool contains (
StringRef stringToLookFor,
176 bool ignoreCase =
false)
const;
189 bool ignoreCase =
false,
190 int startIndex = 0)
const;
194 void add (
String stringToAdd);
203 void insert (
int index,
String stringToAdd);
210 bool addIfNotAlreadyThere (
const String& stringToAdd,
bool ignoreCase =
false);
217 void set (
int index,
String newString);
226 void addArray (
const StringArray& other,
228 int numElementsToAdd = -1);
233 template <
typename Iterator>
236 ensureStorageAllocated (size() + (
int) static_cast<size_t> (end - start));
239 strings.add (*start++);
248 void mergeArray (
const StringArray& other,
249 bool ignoreCase =
false);
258 int addTokens (
StringRef stringToTokenise,
bool preserveQuotedStrings);
274 int addTokens (
StringRef stringToTokenise,
284 int addLines (
StringRef stringToBreakUp);
292 static StringArray fromTokens (
StringRef stringToTokenise,
293 bool preserveQuotedStrings);
308 static StringArray fromTokens (
StringRef stringToTokenise,
318 static StringArray fromLines (
StringRef stringToBreakUp);
332 void remove (
int index);
338 void removeString (
StringRef stringToRemove,
339 bool ignoreCase =
false);
352 void removeRange (
int startIndex,
int numberToRemove);
361 void removeDuplicates (
bool ignoreCase);
367 void removeEmptyStrings (
bool removeWhitespaceStrings =
true);
383 void move (
int currentIndex,
int newIndex) noexcept;
403 void appendNumbersToDuplicates (
bool ignoreCaseWhenComparing,
404 bool appendNumberToFirstInstance,
423 int numberOfElements = -1)
const;
429 void sort (
bool ignoreCase);
444 void ensureStorageAllocated (
int minNumElements);
452 void minimiseStorageOverheads();
460 JUCE_LEAK_DETECTOR (StringArray)
ElementType * begin() const noexcept
Returns a pointer to the first element in the array.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
#define JUCE_API
This macro is added to all JUCE public class declarations.
StringArray(const Array< Type > &stringArray)
Creates a StringArray from an array of objects which can be implicitly converted to Strings...
A simple class for holding temporary references to a string literal or String.
StringArray(StringRef firstValue, OtherElements... otherValues)
Creates an array containing a list of strings.
A special array for holding a list of strings.
ElementType * end() const noexcept
Returns a pointer to the element which follows the last element in the array.
Holds a resizable array of primitive or copy-by-value objects.
String * begin() const noexcept
Returns a pointer to the first String in the array.
int size() const noexcept
Returns the number of strings in the array.
Array< String > strings
This is the array holding the actual strings.
String * end() const noexcept
Returns a pointer to the String which follows the last element in the array.
void addArray(Iterator &&start, Iterator &&end)
Adds items from a range of start/end iterators of some kind of objects which can be implicitly conver...
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...