CkStringArray Java Programming
Reference Documentation

CkStringArray

* This is a freeware class/component/library.

Component for managing and manipulating collections of strings.

Properties

// Returns an integer value
get_Count( )

The number of strings in the array.

// Returns a boolean value
get_Crlf( )

// newVal is a boolean (input)
put_Crlf( newVal )

If true, strings are always automatically converted to use CRLF line endings. If false, strings are automatically converted to use bare LF line endings.

// Returns a boolean value
get_Trim( )

// newVal is a boolean (input)
put_Trim( newVal )

If true, whitespace, including carriage-returns and linefeeds, are automatically removed from the beginning and end of a string when added to the array.

// Returns a boolean value
get_Unique( )

// newVal is a boolean (input)
put_Unique( newVal )

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

// str is a string (input)
Append( str )

Appends a string to the end of the array.

// encodedStr is a string (input)
// Returns a boolean value
AppendSerialized( encodedStr )

Appends multiple strings to the end of the array. The encodedStrings argument is what is returned from the Serialize method (see below).

Clear( )

Remove all strings from the array.

// str is a string (input)
// Returns a boolean value
Contains( str )

Returns true if the string is present in the array. The string comparisons are case sensitive.

// str is a string (input)
// firstIndex is an integer (input)
// Returns an integer value
Find( str, firstIndex )

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.

// index is an integer (input)
// str is a CkString object (output)
// Returns a boolean value
GetString( index, str )

Returns the string at a location in the array. The first string is at index 0.

Returns true for success, false for failure.

// index is an integer (input)
// Returns a string
GetString( index )

Returns the string at a location in the array. The first string is at index 0.

// index is an integer (input)
// str is a string (input)
InsertAt( index, str )

Insert a string into the array at a particular index. Using index 0 will insert at the beginning.

// str is a CkString object (output)
// Returns a boolean value
LastString( str )

Returns the last string in the array.

Returns true for success, false for failure.

// filename is a string (input)
// Returns a boolean value
LoadFromFile( filename )

Adds strings from a file (one per line) into the string array.

Returns true for success, false for failure.

// str is a CkString object (output)
// Returns a boolean value
Pop( str )

Returns the last string and removes it from the array.

Returns true for success, false for failure.

// str is a string (input)
Prepend( str )

Adds a string to the beginning of the array.

// str is a string (input)
Remove( str )

Removes all strings equal to the string argument from the array.

// index is an integer (input)
// Returns a boolean value
RemoveAt( index )

Removes the string at a particular index.

// filename is a string (input)
// Returns a boolean value
SaveToFile( filename )

Saves the array of strings to a file, one string per line.

Returns true for success, false for failure.

// encodedStr is a CkString object (output)
Serialize( encodedStr )

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 true for success, false for failure.

// ascending is a boolean (input)
Sort( ascending )

Sorts the string array in ascending or descending order.

// str is a string (input)
// boundary is a string (input)
SplitAndAppend( str, boundary )

Splits a string at a character or substring boundary and adds each resulting string to the StringArray object.

// index is an integer (input)
// Returns a string
getString( index )

Returns the string at a location in the array. The first string is at index 0.

// Returns a string
lastStr( )

To be documented soon...

// Returns a string
pop( )

Returns the last string and removes it from the array.

// Returns a 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.

// index is an integer (input)
// Returns a string
strAt( index )

To be documented soon...