CkStringArray Python Programming
Reference Documentation

CkStringArray

* This is a freeware class/component/library.

Component for managing and manipulating collections of strings.

Object Creation

obj = chilkat.CkStringArray()

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.

# str is a string (input)
# firstIndex is an integer (input)
# Returns an integer value
FindFirstMatch( str, firstIndex )

To be documented soon...

# 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)
# Returns an integer value
GetStringLen( index )

Returns Nth's string length, in characters. 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 string (input)
LoadFromText( str )

Adds strings from an in-memory string (one per line) into the string array.

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

# index is an integer (input)
# filename is a string (input)
# Returns a boolean value
SaveNthToFile( index, filename )

Saves the Nth string in the StringArray object to a file.

Returns True for success, False for failure.

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

# outStr is a CkString object (output)
SaveToText( outStr )

Saves the array of strings to a single string, one string per line (separated by CRLF line endings).

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

# array is a CkStringArray object (output)
Union( array )

Performs the union set-operator. The caller will contain the union of two string arrays.

# 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
saveToText( )

Saves the array of strings to a single string, one string per line (separated by CRLF line endings).

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