CkStringArray Perl 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.

# Returns a boolean value
get_Utf8( )

# b is a boolean (input)
put_Utf8( b )

When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.

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 1 for success, 0 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 1 for success, 0 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 1 for success, 0 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 1 for success, 0 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 1 for success, 0 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 1 for success, 0 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...