Standard library is used for strings. For details see
field_name1 string(10) field_name2 string(10) sep="" field_name3 string sep=";" null="NULL" field_name4 string null="" quote="\"" field_name5 string null=["","N/A","NA"] last_field string
- ‘field_name1’ cannot be NULL and has fixed length 10 bytes, followed by ‘EVL_DEFAULT_FIELD_SEPARATOR’.
- ‘field_name2’ cannot be NULL and has fixed length 10 bytes, with no separator.
- ‘field_name3’ is nullable and string ‘NULL’ is interpreted as NULL value. End of the field is represented by character ‘;’.
- ‘field_name4’ is nullable and empty string is interpreted as NULL value. Field is quoted by ‘"’, but for an empty string, quotes are not needed. The end of the field is represented by ‘EVL_DEFAULT_FIELD_SEPARATOR’.
- ‘field_name5’ is nullable and empty string, ‘N/A’ and ‘NA’ are interpreted as NULL value when reading, but when writing into text file, NULL is represented by the first one, i.e. an empty string. The end of the field is represented by ‘EVL_DEFAULT_FIELD_SEPARATOR’.
- ‘last_field’ cannot be NULL and the end of the field is represented by ‘EVL_DEFAULT_RECORD_SEPARATOR’.
Example of four records which can be processed by above EVD file definition2:
| NULL;"second string field"|NA|last field 0123456789|0123456789first string field;""|N/A|last field ----------|----------;" ; second field | "|third string field|last field abcdefghij|abcdefghij ;||last field
Standard methods from the library ‘basic_string’, where ‘a’, ‘b’ are strings, ‘c’ is a char, ‘i’ is an (unsigned) int):
checks whether the string ‘a’ is empty,
returns the number of characters,
clears the contents of string ‘a’,
removes from string ‘a’ characters from after ‘position’ of the size ‘size’,
appends a character ‘c’ to the end,
removes the last character,
appends characters to the end,
concatenates two strings or a string and a char,
replaces in string ‘a’ from after ‘position’ of size ‘size’ by string ‘b’,
returns a substring of ‘a’ from after ‘position’ and of length ‘size’,
changes the number of characters stored, if ‘i’ is shorter than current length then it simply cuts, if ‘i’ is longer, then add character ‘c’ to fill the length ‘i’,
swaps the contents of ‘a’ and ‘b’.
find characters in the string,
find the last occurrence of a substring,
find first occurrence of characters,
find first absence of characters,
find last occurrence of characters,
find last absence of characters.
Operators ==, != <, >, <=, >=
lexicographically compares two strings,
compares two strings.
converts a string to an integer,
converts a string to a long,
converts a string to an unsigned long,
converts a string to a float,
converts a string to a double,
converts an integral or floating point value to string.
EVL specific string functions
The advantage of using EVL specific function is that they handle NULLs, i.e. when the string is NULL, then also the output is NULL. Using native C++ functions need to handle NULLs conditionally.
The list of such function:
to convert ordinary string to its hexadecimal representation and vice versa,
returns the length of given string,
returns MD5 checksum,
SHA checksum functions,
to split a string into a vector,
to check if a string starts or ends with a given character or string ‘substr’,
to un/compress a string by given method: snappy or gzip,
returns the number of ‘substr’ occurrences,
returns the position of ‘substr’ from left or right,
to replace by ‘char’ the specified number of characters from left/right,
to add from left/right the specified character, up to the given length,
to replace a string or character ‘strA’ by ‘strB’,
it returns a substring starting after position ‘pos’ of the specified length ‘len’.
trim(str), trim_left(str), trim_right(str)
to trim a string by specified character,
to change to uppercase or lowercase string, ...
where ‘str’ is the string or a pointer to the string.
See String Functions for details.
Neither ‘EVL_DEFAULT_FIELD_SEPARATOR’ nor ‘EVL_DEFAULT_RECORD_SEPARATOR’ is set, so default values are used, i.e. ‘|’ and ‘\n’.