String - String value
odaba::Strings are used for passing parameters to and retrieve content from ODABA interface functions. The odaba::String class provides character strings of defined StringCodingTypes . odaba::String uses implicit sharing (copy-on-write) to reduce memory usage and to avoid the needless copying of data.
Beside the String data type, more specific string classes are provided in order to support strings with more specific syntax:
- Key ( TypedString ) - passing key values in CSV format
- Instance ( TypedString ) - passing key values in ESDF format
- OSIString - passing access paths or expressions in OSI format
The behavior of odaba:String is similar to QString from QT. odaba:String supports units, bytes and code points (characters) for expressing positions in a string. When not explicitly stated differently, code points are used by default. The class does not support combined characters.
Under Linux, default encoding is set to UTF8, UTF16 or UTF32, when system locale refers to UTF encoding.
For UTF8 or UTF16 encoding, units may differ from code points, since unit size is 1 or 2, while code point size may reach 4 bytes.
The odaba::String class supports fifferent encoding types for text data. The default text data types STRING and CHAR are strored in local encoding format, which depends on computer configuration, i.e. as long as an application is using STRING and CHAR for text data types, the application will run without any problem, since all string constants provided within the application are also assumed to be defined in local 8 bit encoding.
When, however, data has to be imported from external sources, this might be provided using different coding types (e.g. UTF8). Also, some applications need to support multi-lingual text fields, in wchich case richer text encodings are required. Such cases might be handled by using unicode encoding types provide as text data types UTF8 , UTF16 or UTF32 . When reading data stored with unicode encoding types, it is provided by default with te encoding type as being defined in the database. Passing those strings to the .NET interface, always recodes strings to UTF16. In C++ applications the application has to care about proper encoding formats.
Nevertheless, the String class provides implicit recoding whenever meaningfull. The rule is, that parameters or operands will be recoded to the encoding type of the result string or the string to be manupulated. In some cases (e.g. operator+), the result string is undefined or there is no result string. In those cases, the right operand is recoded into the encoding type of the left operand or parameters are encoded into the coding type of the calling String object.
- 1. Administration - Administration functions
- 2. Access - Access functions
- 2.1. Conversion - String conversion
- 2.2. Operation - String operations
- 2.3. Compare - Compare functions
- String - Constructor
- alignText - Aling text in block format
- append - Append a String
- area - Returns the pointer to the string data area
- assign - Assigns a string data reference
- capacity - Get the number of character units which can be stored in the allocated area.
- chop - Remove count characters from the end
- clear - Clear string data
- codingType - Property string coding type
- compare - Compares this string data with data of another specified string.
- concat - Concatenates two specified instances of String.
- contains - Search for a String occurence
- data - Returns a pointer to the 8 bit string data area
- data16 - Returns a pointer to the 16 bit string data area
- data32 - Returns a pointer to the 32 bit string data area
- erase - Erase characters from String
- executePath - Execute action according to file type
- extract - Get string between begin end end tag
- fill - Fill the String
- firstPosition - Locate first occurence of character in string
- fromCString - Convert string from C-string
- index - Get character at position
- indexOf - Find a substring
- insert - Insert into String
- isEmpty - Determines whether the string contains no data.
- isNull - Determines whether the string data pointer is null.
- isNumber - Does string contain numerical value
- lastPosition - Locate last occurence of character in string
- left - Get leftmost characters of the string
- leftJustified - Get a fixed length String left padded by a fill character.
- length - Gets the number of code points in the current String object.
- lengthInBytes - Gets the number of bytes stored in the current String object.
- lengthInUnits - Gets the number of text elements in the current String object.
- loadFile - Read file into string
- match - Check whether the string match the mask
- mid - Get Substring
- operator!= - Are string values different
- operator+ - Concatenates two Strings
- operator+= - Appends a String
- operator< - Is left operand lower than right operand
- operator<= - Is left operand lower or equal
- operator= - Assigns a string data reference.
- operator== - Are string values equal
- operator> - Is left operand greater than right operand
- operator>= - Is left operand greater or equal
- prepend - Insert a String at the beginning
- replace - Replace specified string or text range by new string
- replaceOptions - Replace option variables in a string
- reserve - Reserve memory for iSize character units.
- right - Get a substring that contains a number of rightmost characters of the string
- rightJustified - Get a fixed length String with fill characters followed by string.
- splitPop - Extract terminating string
- splitTop - Extract leading string
- squeeze - Release unused storage
- storeFile - Write text file from string
- to8Bit - Get 8-bit representation of the string.
- toASCII - Recode string to ASCII
- toBool - Convert string to boolean
- toCString - Convert string to C-string
- toDefault - Recode string to default encoding
- toDouble - Returns the string converted to a double
- toInteger - Returns the string converted to a 32 bit integer
- toLatin1 - Recode string to Latin1
- toLocal8Bit - Recode string to local encoding
- toLongLong - Returns the string converted to a 64 bit integer
- toLower - Convert to lowercase
- toPlainText - Convert HTML text to plain text
- toUTF16 - Recode string to UTF16
- toUTF32 - Recode string to UTF32
- toUTF8 - Recode string to UTF8
- toUpper - Convert to uppercase
- trimmed - Get String without whitespace at start and end.
- truncate - Truncate string at the given position index
- ~String - Destructor