Chilkat.StringArray PHP Reference
Chilkat.StringArray
* This is a freeware class/component/library.
Component for managing and manipulating collections of strings.
Object Creation
$obj = new COM("Chilkat.StringArray");
Properties
int Count (read-only)
The number of strings in the array.
bool Crlf
If true, strings are always automatically converted to use CRLF line endings. If false, strings are automatically converted to use bare LF line endings.
bool Trim
If true, whitespace, including carriage-returns and linefeeds, are automatically removed from the beginning and end of a string when added to the array.
bool Unique
If true, the array does not allow duplicates. When an attempt is made to insert a string that already exists in the array, the insertion simply doesn't happen and no error is returned.
Methods
void Append(string str)
Appends a string to the end of the array.
void AppendSerialized(string encodedStr)
Appends multiple strings to the end of the array. The encodedStrings argument is what is returned from the Serialize method (see below).
void Clear()
Remove all strings from the array.
bool Contains(string str)
Returns true if the string is present in the array. The string comparisons are case sensitive.
int Find(string str, int beginIndex)
Finds the index of the first string equal to the string passed. The search begins at beginIndex. If the string is not found, -1 is returned. The first string in the array is at index 0.
int FindFirstMatch(string str, int beginIndex)
To be documented soon...
string GetString(int index)
Returns the string at a location in the array. The first string is at index 0. Returns a null on failure
void InsertAt(int index, string str)
Insert a string into the array at a particular index. Using index 0 will insert at the beginning.
void Intersect(Chilkat.StringArray array)
The caller will contain the intersection of both string arrays. (In other words, all strings that are present in both the calling object and the argument object.)
string LastString()
Returns the last string in the array. Returns a null on failure
bool LoadFromFile(string filename)
Adds strings from a file (one per line) into the string array. Returns 1 for success, 0 for failure.
void LoadFromText(string txt)
Adds strings from an in-memory string (one per line) into the string array.
string Pop()
Returns the last string and removes it from the array. Returns a null on failure
void Prepend(string str)
Adds a string to the beginning of the array.
void Remove(string str)
Removes all strings equal to the string argument from the array.
void RemoveAt(int index)
Removes the string at a particular index.
bool SaveNthToFile(int index, string filename)
Saves the Nth string in the StringArray object to a file. Returns 1 for success, 0 for failure.
bool SaveToFile(string filename)
Saves the array of strings to a file, one string per line. Returns 1 for success, 0 for failure.
string SaveToText()
Saves the array of strings to a single string, one string per line (separated by CRLF line endings).
string Serialize()
Returns an string which is an encoded representation of all the strings in the array. The StringArray can be re-created by calling the AppendSerialized method. One reason this method exists is to make it easy to pass entire string arrays as a form parameter in a Web page. Returns a null on failure
void Sort(int ascending)
Sorts the string array in ascending or descending order.
void SplitAndAppend(string str, string boundary)
Splits a string at a character or substring boundary and adds each resulting string to the StringArray object.
void Subtract(Chilkat.StringArray array)
Subtracts the strings in the argument object from the calling object's set.
void Union(Chilkat.StringArray array)
Performs the union set-operator. The caller will contain the union of two string arrays.
|