|  | mdz_ansi_16 Overview and Referencemdz_ansi_16 - very lightweight, speedy and portable ANSI C 89/90 compliant library for processing single-byte strings. Minimal dependencies, metadata encapsulated, no dynamic memory use.
The source code is highly-portable and conforms to the ANSI C 89/90 standard. Builds are available for Win32/Win64, Linux, FreeBSD, Android, macOS.
mdz_ansi_16 Advantages
1. High Portability: The entire codebase conforms to the ANSI C 89/90 standard.
2. Minimal Dependencies: mdz_ansi_16 functions solely depend on standard C-library functions. This means you can integrate the library into your code without any additional dependencies beyond the standard platform libraries/APIs.
3. Performance: The library functions are highly optimized for speed, particularly for operations like searching.
4. Flexibilty: Most library functions offer both "left position" and "right position" parameters, allowing you to limit the processing area. Additionally, the library provides more string functions than comparable libraries such as STL, Boost, or GLib.
5. Extended Error-Checking: All functions use strict error-checking mechanisms and return specific error codes pointing the problem precisely.
6. Extended Control: The functions perform only explicit operations. For example, when an "insert" function is called, it will return an error if there is not enough capacity in string - no implicit memory allocations/reservations will be made.
7. No Memory Overhead: The functions are designed to process input data without making internal memory allocations or using dynamic memory.
8. Metadata encapsulated: String controls its Size and Capacity, thus making automatical checking and if necessary adjustment during each string function call.
Please refer to mdz_ansi_16 Wiki for API details.
 mdz_ansi_16 API Referencemdz_ansi_16 is library for contiguous single-byte String, containing ASCII (0..127) and "ANSI" (128 - 255) characters.
 Dynamic memory-allocations inside library functions are only possible, if according allocation functions are set by user.
 
 String can be dynamically allocated or attached to static/pre-allocated char
 buffer.
 
 String   - contains metadata like
 Size,Capacity, etc. and Data consisting of Items. String may contain 0-terminators ('\0') inside, and MUST end with 0-terminator.Item     - single element/character of String or of buffer passed as parameter for insertion, removing, find, etc. For this single-byte String Item is always a byte.
 
 Capacity- how many Items is reserved for String content.Capacitydoes NOT include ending 0-terminator byte.
 Size- how many Items are actually residing in a String.
 Init functions:
mdz_ansi_16_init
 mdz_ansi_16_setAllocFunctions
 mdz_ansi_16_create
 mdz_ansi_16_fromText
 mdz_ansi_16_attach
 mdz_ansi_16_destroy
 mdz_ansi_16_clear
Status functions:
mdz_ansi_16_minBufferSize
 mdz_ansi_16_maxCapacity
 mdz_ansi_16_size
 mdz_ansi_16_capacity
 mdz_ansi_16_data
 mdz_ansi_16_dataConst
Insert/remove functions:
mdz_ansi_16_reserve
 mdz_ansi_16_insert
 mdz_ansi_16_append
 mdz_ansi_16_removeFrom
 mdz_ansi_16_remove
 mdz_ansi_16_trimLeft
 mdz_ansi_16_trimRight
 mdz_ansi_16_trim
Find functions:
mdz_ansi_16_findSingle
 mdz_ansi_16_find
 mdz_ansi_16_rfindSingle
 mdz_ansi_16_rfind
 mdz_ansi_16_firstOf
 mdz_ansi_16_firstNotOf
 mdz_ansi_16_lastOf
 mdz_ansi_16_lastNotOf
Miscellaneous functions:
mdz_ansi_16_equal
 mdz_ansi_16_compare
 mdz_ansi_16_count
 mdz_ansi_16_replace
 mdz_ansi_16_reverse
 Initializes mdz_ansi_16 library and license. This function should be called before any other function of the library.
 mdz_bool mdz_ansi_16_init(const unsigned long* pnFirstNameHash, const unsigned long* pnLastNameHash, const unsigned long* pnEmailHash, const unsigned long* pnLicenseHash);| Parameter | Description | 
|---|
 | pnFirstNameHash | user first name hash code |  | pnLastNameHash | user last name hash code |  | pnEmailHash | user e-mail hash code |  | pnLicenseHash | license hash code | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | mdz_true | if the initialization succeeded, otherwise mdz_false | 
 Set allocation functions for dynamic memory-management. If functions are not set - library is only using static memory, thus no dynamic memory allocations.
 void mdz_ansi_16_setAllocFunctions(mdz_AllocFunc pAllocFunc, mdz_ReallocFunc pReallocFunc, mdz_FreeFunc pFreeFunc);mdz_ansi_16 Reference| Parameter | Description | 
|---|
 | pAllocFunc | pointer to allocate memory function. Used in string-creation functions like mdz_ansi_16_create(). Can beNULL |  | pReallocFunc | pointer to re-allocate memory function. Used in string-resizing fuinctons like mdz_ansi_16_insert(). Can beNULL |  | pFreeFunc | pointer to free memory function. Used in string-destroying functions like mdz_ansi_16_destroy(). Can beNULL | 
 Create empty String with
 CapacitynCapacityandSize0. This function uses dynamic-memory allocatormalloc()function set inmdz_ansi_16_setAllocFunctions()mdz_Ansi16* mdz_ansi_16_create(unsigned short nCapacity, enum mdz_error* penError);| Parameter | Description | 
|---|
 | nCapacity | initial Capacityof String data in Items |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_16_dyn_init() or invalid |  |  | MDZ_ERROR_CAPACITY | nCapacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_ALLOC_FUNC | dynamic-memory allocator malloc()function is not set (using mdz_16_dyn_setAllocFunctions()) |  |  | MDZ_ERROR_ALLOCATION | could not alocate memory |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | NULL | function failed |  | Result | pointer to String for use in other mdz_ansi_16 functions | 
 Create String including
 pcTextwith 0-terminator. This function uses dynamic-memory allocatormalloc()function set inmdz_ansi_16_setAllocFunctions()mdz_Ansi16* mdz_ansi_16_fromText(const char* pcText, size_t nLength, enum mdz_error* penError);| Parameter | Description | 
|---|
 | pcText | text to insert during creation. Cannot be NULL, but can contain 0-terminators inside |  | nLength | length of pcText, or 0 forpcTextlength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_16_dyn_init() or invalid |  |  | MDZ_ERROR_ITEMS | pcTextisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nLengthis 0 andpcTextis empty (0-terminator) |  |  | MDZ_ERROR_BIG_COUNT | nLength> maximal possibleCapacity |  |  | MDZ_ERROR_ALLOC_FUNC | dynamic-memory allocator malloc()function is not set (using mdz_16_dyn_setAllocFunctions()) |  |  | MDZ_ERROR_ALLOCATION | could not alocate memory |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | NULL | function failed |  | Result | pointer to String for use in other mdz_ansi_16 functions | 
 Attach String to pre-allocated
 pcBufferofnBufferSizebytes. IfpenErroris notNULL, error will be written theremdz_Ansi16* mdz_ansi_16_attach(char* pcBuffer, unsigned short nBufferSize, enum mdz_error* penError);| Parameter | Description | 
|---|
 | pcBuffer | pointer to pre-allocated buffer to attach |  | nBufferSize | size of pcBufferin bytes. Minimal-possible buffer size is returned bymdz_ansi_16_minBufferSize()- in this caseCapacityis 0 |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | pcBufferisNULL |  |  | MDZ_ERROR_CAPACITY | nBufferSize< minimal buffer size, returned bymdz_ansi_16_minBufferSize() |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | NULL | function failed |  | Result | pointer to String for use in other mdz_ansi_16 functions | 
 Destroy String. If String is created using
 mdz_ansi_16_create()-free()function set inmdz_ansi_16_setAllocFunctions()will be used for destroying.enum mdz_error mdz_ansi_16_destroy(mdz_Ansi16* psAnsi);| Parameter | Description | 
|---|
 | psAnsi | pointer to String | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_FREE_FUNC | could not destroy String created with mdz_ansi_16_create(), becausefree()function is not set usingmdz_ansi_16_setAllocFunctions() |  | MDZ_ERROR_NONE | function succeeded | 
 Clear Data of String with setting
 Sizeto 0.void mdz_ansi_16_clear(struct mdz_Ansi16* psAnsi);mdz_ansi_16 Reference| Parameter | Description | 
|---|
 | psAnsi | pointer to String | 
 Return size of minimal buffer for attachment using
 mdz_ansi_16_attach().Capacityof such a String is 0unsigned short mdz_ansi_16_minBufferSize(void);mdz_ansi_16 Reference| Return | Description | 
|---|
 | 0 | if mdz_ansi_16_init()was not called |  | Size | otherwise | 
 Return size of maximal
 Capacityunsigned short mdz_ansi_16_maxCapacity(void);mdz_ansi_16 Reference| Return | Description | 
|---|
 | 0 | if mdz_ansi_16_init()was not called |  | Size | otherwise | 
 Return
 Sizeof String Data in Itemsunsigned short mdz_ansi_16_size(const mdz_Ansi16* psAnsi);| Parameter | Description | 
|---|
 | psAnsi | pointer to String | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | 0 | if psAnsiisNULL |  | Size | otherwise | 
 Return
 Capacityof string Data in Itemsunsigned short mdz_ansi_16_capacity(const mdz_Ansi16* psAnsi);| Parameter | Description | 
|---|
 | psAnsi | pointer to String | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | 0 | if psAnsiisNULL |  | Capacity | otherwise | 
 Return pointer to String Data.
 char* mdz_ansi_16_data(mdz_Ansi16* psAnsi);| Parameter | Description | 
|---|
 | psAnsi | pointer to String | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | 0 | if psAnsiisNULL |  | Data | otherwise | 
 Return const pointer to string Data.
 const char* mdz_ansi_16_dataConst(const mdz_Ansi16* psAnsi);| Parameter | Description | 
|---|
 | psAnsi | pointer to String | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | 0 | if psAnsiisNULL |  | Data | otherwise | 
 Reserve
 nNewCapacityfor String usingrealloc()function set inmdz_ansi_16_setAllocFunctions(). StringSizedoes not change.enum mdz_error mdz_ansi_16_reserve(mdz_Ansi16** ppsAnsi, unsigned short nNewCapacity);| Parameter | Description | 
|---|
 | ppsAnsi | pointer to address of String returned by mdz_ansi_create() or mdz_ansi_create_attached() |  | nNewCapacity | new capacity in Items to reserve. If nNewCapacity<= currentCapacity, there are no changes and MDZ_ERROR_NONE is returned | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | ppsAnsiisNULLor *ppsAnsiisNULL |  | MDZ_ERROR_CAPACITY | current CapacityornNewCapacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ATTACHED | String is attached using mdz_ansi_16_attach(), thus cannot be reallocated |  | MDZ_ERROR_REALLOC_FUNC | could not realloc String created with mdz_ansi_16_create(), becauserealloc()function is not set usingmdz_ansi_16_setAllocFunctions() |  | MDZ_ERROR_ALLOCATION | String reallocation failed |  | MDZ_ERROR_NONE | function succeeded | 
 Insert
 pcItemsinto Data fromnLeftPosposition. Data andpcItemscannot overlap. NewSizeis written in psAnsi.enum mdz_error mdz_ansi_16_insert(mdz_Ansi16** ppsAnsi, unsigned short nLeftPos, const char* pcItems, size_t nCount, mdz_bool bReserve);| Parameter | Description | 
|---|
 | ppsAnsi | pointer to address of String. It should have enough Capacityfor insertion ofpcItems |  | nLeftPos | 0-based position to insert. If nLeftPos==Size,pcItemsis appended.nLeftPos>Sizeis not allowed |  | pcItems | items to insert. Cannot be NULL |  | nCount | length of pcItemsto insert, or 0 forpcItemslength until 0-terminator |  | bReserve | if mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | ppsAnsiisNULLor *ppsAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_LEFT | nLeftPos>Size |  | MDZ_ERROR_OVERLAP | [Data .. Data + Size+nCount] area andpcItemsoverlap |  | MDZ_ERROR_BIG_COUNT | Size+nCount> maximal possibleCapacityandbReserveis mdz_false |  | MDZ_ERROR_ATTACHED | String has not enough capacity for insertion, but is attached using mdz_ansi_16_attach(), thus cannot be reallocated |  | MDZ_ERROR_REALLOC_FUNC | could not realloc String created with mdz_ansi_16_create(), becauserealloc()function is not set usingmdz_ansi_16_setAllocFunctions() |  | MDZ_ERROR_ALLOCATION | String reallocation failed |  | MDZ_ERROR_NONE | function succeeded | 
 Append
 pcItemsto Data. Data andpcItemscannot overlap. NewSizeis written in psAnsi.enum mdz_error mdz_ansi_16_append(mdz_Ansi16** ppsAnsi, const char* pcItems, size_t nCount, mdz_bool bReserve);| Parameter | Description | 
|---|
 | ppsAnsi | pointer to address of String. It should have enough Capacityfor appending ofpcItems |  | pcItems | items to append. Cannot be NULL |  | nCount | length of pcItemsto append, or 0 forpcItemslength until 0-terminator |  | bReserve | if mdz_true reserve capacity when there is not enough space for appending, otherwise mdz_false | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | ppsAnsiisNULLor *ppsAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_COUNT | Size+nCount> maximal possibleCapacityorbReserveis mdz_false |  | MDZ_ERROR_OVERLAP | [Data; Data + Size+nCount] area andpcItemsoverlap |  | MDZ_ERROR_ATTACHED | String has not enough capacity for appending, but is attached using mdz_ansi_16_attach(), thus cannot be reallocated |  | MDZ_ERROR_REALLOC_FUNC | could not realloc String created with mdz_ansi_16_create(), becauserealloc()function is not set usingmdz_ansi_16_setAllocFunctions() |  | MDZ_ERROR_ALLOCATION | String reallocation failed |  | MDZ_ERROR_NONE | function succeeded | 
 Find first occurrence of
 cItem. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_findSingle(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, char cItem, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of Data |  | nRightPos | 0-based end position to search up to. Use Size-1 or USHRT_MAX to search till the end of Data |  | cItem | Item to find |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if cItemnot found or error happened |  | Result | 0-based position of first match | 
 Find first occurrence of
 pcItemsusing optimized Boyer-Moore-Horspool search. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_find(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of Data |  | nRightPos | 0-based end position to search up to. Use Size-1 or USHRT_MAX to search till the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_BIG_COUNT | nCountis bigger than search area (betweennLeftPosandnRightPos) |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if pcItemsnot found or error happened |  | Result | 0-based position of first match | 
 Find last occurrence of
 cItem. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_rfindSingle(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, char cItem, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of Data |  | nRightPos | 0-based start position to find from right. Use Size-1 or USHRT_MAX to search from the end of Data |  | cItem | Item to find |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if cItemnot found or error happened |  | Result | 0-based position of first match | 
 Find last occurrence of
 pcItemsusing optimized Boyer-Moore-Horspool search. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_rfind(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of Data |  | nRightPos | 0-based start position to find from right. Use Size-1 or USHRT_MAX to search from the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_BIG_COUNT | nCountis bigger than search area (betweennLeftPosandnRightPos) |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if pcItemsnot found or error happened |  | Result | 0-based position of first match | 
 Find first occurrence of any Item of
 pcItems. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_firstOf(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of Data |  | nRightPos | 0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if no Item of pcItemsfound or error happened |  | Result | 0-based position of first match | 
 Find first non-occurrence of any Item of
 pcItems. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_firstNotOf(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of Data |  | nRightPos | 0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if no Item of pcItemsfound or error happened |  | Result | 0-based position of first match | 
 Find last occurrence of any Item of
 pcItems. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_lastOf(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of Data |  | nRightPos | 0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if no Item of pcItemsfound or error happened |  | Result | 0-based position of first match | 
 Find last non-occurrence of any Item of
 pcItems. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. IfpenErroris notNULL, error will be written thereunsigned short mdz_ansi_16_lastNotOf(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to find up to. Use 0 to search till the beginning of Data |  | nRightPos | 0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | USHRT_MAX | if no Item of pcItemsfound or error happened |  | Result | 0-based position of first match | 
 Remove
 nCountItems starting from 0-basednLeftPospositionenum mdz_error mdz_ansi_16_removeFrom(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nCount);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to remove Items from. Use 0 to remove from the beginning of Data |  | nCount | number of Items to remove. Cannot be 0 | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_LEFT | nLeftPos>=Size |  | MDZ_ERROR_BIG_COUNT | nCountis bigger than remove area (betweennLeftPosandSize) |  | MDZ_ERROR_NONE | function succeeded or Sizeis 0 (String is empty) | 
 Remove all ocurrences of
 pcItemswith lenthnCount, residing betweennLeftPosandnRightPosenum mdz_error mdz_ansi_16_remove(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, mdz_bool bFromLeft);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to remove pcItemsfrom. Use 0 to search from the beginning of Data |  | nRightPos | 0-based end position to remove pcItemsup to. Use Size-1 to search till the end of Data |  | pcItems | items to remove. Cannot be NULL |  | nCount | length of pcItemsto remove, or 0 forpcItemslength until 0-terminator |  | bFromLeft | mdz_true if search for pcItemsto remove from left side, otherwise from right | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  | MDZ_ERROR_BIG_COUNT | nCountis bigger than search area (betweennLeftPosandnRightPos) |  | MDZ_ERROR_NONE | function succeeded or Sizeis 0 (String is empty) | 
 Remove Items which are contained in
 pcItemsfrom left, until first Item non-contained inpcItemsis reached.enum mdz_error mdz_ansi_16_trimLeft(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to trim Items from left. Use 0 to trim from the beginning of Data |  | nRightPos | 0-based end position to trim Items up to. Use Size-1 to trim till the end of Data |  | pcItems | items to trim. Cannot be NULL |  | nCount | length of pcItemsto trim, or 0 forpcItemslength until 0-terminator | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  | MDZ_ERROR_NONE | function succeeded or Sizeis 0 (String is empty) | 
 Remove Items which are contained in
 pcItemsfrom right, until first Item non-contained inpcItemsis reached.enum mdz_error mdz_ansi_16_trimRight(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based end position to trim Items up to. Use 0 to trim till the beginning of Data |  | nRightPos | 0-based start position to trim Items from right. Use Size-1 to trim from the end of Data |  | pcItems | items to trim. Cannot be NULL |  | nCount | length of pcItemsto trim, or 0 forpcItemslength until 0-terminator | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  | MDZ_ERROR_NONE | function succeeded or Sizeis 0 (String is empty) | 
 Remove Items which are contained in
 pcItemsfrom left and from right, until first non-contained inpcItemsItem is reached.enum mdz_error mdz_ansi_16_trim(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to trim Items from left. Use 0 to trim from the beginning of Data |  | nRightPos | 0-based start position to trim Items from right. Use Size-1 to trim from the end of Data |  | pcItems | items to trim. Cannot be NULL |  | nCount | length of pcItemsto trim, or 0 forpcItemslength until 0-terminator | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  | MDZ_ERROR_NONE | function succeeded or Sizeis 0 (String is empty) | 
 Compare content of Data with
 pcItemson equalty by length and content. IfpenErroris notNULL, error will be written thereenum mdz_ansi_compare_result mdz_ansi_16_equal(const mdz_Ansi16* psAnsi, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | pcItems | items to compare. Cannot be NULL |  | nCount | length of pcItemsto compare, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_COMPARE_EQUALorMDZ_COMPARE_NONEQUAL | Result of comparison | 
 Compare content of Data with
 pcItems. IfpenErroris notNULL, error will be written thereenum mdz_ansi_compare_result mdz_ansi_16_compare(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, const char* pcItems, size_t nCount, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to compare from left. Use 0 to compare from the beginning of Data |  | pcItems | items to compare. Cannot be NULL |  | nCount | length of pcItemsto compare, or 0 forpcItemslength until 0-terminator |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>=Size |  |  | MDZ_ERROR_BIG_COUNT | nCountis bigger than compare area (betweennLeftPosandSize) |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_COMPARE_EQUALorMDZ_COMPARE_NONEQUAL | Result of comparison | 
 Counts number of
 pcItemssubstring occurences in Data. IfpenErroris notNULL, error will be written theresize_t mdz_ansi_16_count(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, mdz_bool bAllowOverlapped, mdz_bool bFromLeft, enum mdz_error* penError);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of Data |  | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of Data |  | pcItems | items to find. Cannot be NULL |  | nCount | length of pcItemsto find, or 0 forpcItemslength until 0-terminator |  | bAllowOverlapped | mdz_true if overlapped substrings should be counted, otherwise mdz_false |  | bFromLeft | mdz_true if search for pcItemsto count from left side, otherwise from right |  | penError | if not NULL, error will be written there. There are following errors possible: |  |  | Value | Description | 
|---|
 |  | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  |  | MDZ_ERROR_DATA | psAnsiisNULL |  |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  |  | MDZ_ERROR_ITEMS | pcItemsisNULL |  |  | MDZ_ERROR_ZERO_COUNT | nCountis 0 |  |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  |  | MDZ_ERROR_BIG_COUNT | nCountis bigger than search area (betweennLeftPosandnRightPos) |  |  | MDZ_ERROR_NONE | function succeeded | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | SIZE_MAX | if error happened |  | Result | count of substring occurences. 0 if not found | 
 Replace every occurence of
 pcItemsBeforewithpcItemsAfterin Data. There should be enoughCapacityfor replacing data.enum mdz_error mdz_ansi_16_replace(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItemsBefore, size_t nCountBefore, const char* pcItemsAfter, size_t nCountAfter, mdz_bool bFromLeft, enum mdz_ansi_replace_type enReplacementType);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of Data |  | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of Data |  | pcItemsBefore | items to find. Cannot be NULL |  | nCountBefore | length of pcItemsBeforeto find, or 0 forpcItemsBeforelength until 0-terminator |  | pcItemsAfter | pointer to items to replace with. Can be NULL(in this casenCountAfteris treated as 0) |  | nCountAfter | length of pcItemsAfterto replace, or 0 for pcItems length until 0-terminator |  | bFromLeft | mdz_true if search for pcItemsBeforeto replace from left side, otherwise from right |  | enReplacementType | type of replacement when nCountAfter>nCountBefore(thusSizeis growing). For now only MDZ_ANSI_REPLACE_DUAL is supported (please refer to description of mdz_ansi_replace_type enum) | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_ITEMS | pcItemsBeforeisNULL |  | MDZ_ERROR_ZERO_COUNT | nCountBeforeis 0 |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  | MDZ_ERROR_BIG_LEFT | nLeftPos>nRightPos |  | MDZ_ERROR_BIG_COUNT | nCount is bigger than search area (between nLeftPosandnRightPos) |  | MDZ_ERROR_OVERLAP | Data overlaps with pcItemsBefore, or Data overlaps withpcItemsAfter |  | MDZ_ERROR_BIG_REPLACE | new Sizeafter replacement >Capacity |  | MDZ_ERROR_OVERLAP_REPLACE | Data after replacement - overlaps with pcItemsBefore, or Data after replacement - overlaps withpcItemsAfter |  | MDZ_ERROR_NONE | function succeeded or Sizeis 0 (String is empty) | 
 Reverses Items in string, like "1234" into "4321".
 enum mdz_error mdz_ansi_16_reverse(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos);| Parameter | Description | 
|---|
 | psAnsi | pointer to String |  | nLeftPos | 0-based start position to search from left. Use 0 to search from the beginning of Data |  | nRightPos | 0-based end position to search up to. Use Size-1 to search till the end of Data | 
 mdz_ansi_16 Reference| Return | Description | 
|---|
 | MDZ_ERROR_LICENSE | license is not initialized using mdz_ansi_16_init()or invalid |  | MDZ_ERROR_DATA | psAnsiisNULL |  | MDZ_ERROR_CAPACITY | Capacity> maximal-possible capacity, returned bymdz_ansi_16_maxCapacity() |  | MDZ_ERROR_BIG_SIZE | Size>Capacity |  | MDZ_ERROR_TERMINATOR | there is no 0-terminator on Data[ Size] position |  | MDZ_ERROR_BIG_RIGHT | nRightPos>=Size |  | MDZ_ERROR_BIG_LEFT | nLeftPos>=nRightPos |  | MDZ_ERROR_NONE | function succeeded | 
 |