Site Logo

maxdz Software GmbH

en | de
Home

Team

Products

mdz_ansi_alg

mdz_ansi_16

mdz_ui

mdz_xml

mdz_string

mdz_vector

mdzWebSiteGenerator

mdzTennisTracker

Shop

Legals

Contacts

mdz_ansi_16 Overview and Reference

mdz_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 Reference


mdz_ansi_16 API Reference is generated using mdzApiRefGenerator.

mdz_ansi_16 General Information and Functions

mdz_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. Capacity does 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


mdz_ansi_16_init

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);

ParameterDescription
pnFirstNameHashuser first name hash code
pnLastNameHashuser last name hash code
pnEmailHashuser e-mail hash code
pnLicenseHashlicense hash code

ReturnDescription
mdz_trueif the initialization succeeded, otherwise mdz_false

mdz_ansi_16 Reference

mdz_ansi_16_setAllocFunctions

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);

ParameterDescription
pAllocFuncpointer to allocate memory function. Used in string-creation functions like mdz_ansi_16_create(). Can be NULL
pReallocFuncpointer to re-allocate memory function. Used in string-resizing fuinctons like mdz_ansi_16_insert(). Can be NULL
pFreeFuncpointer to free memory function. Used in string-destroying functions like mdz_ansi_16_destroy(). Can be NULL

mdz_ansi_16 Reference

mdz_ansi_16_create

Create empty String with Capacity nCapacity and Size 0. This function uses dynamic-memory allocator malloc() function set in mdz_ansi_16_setAllocFunctions()

mdz_Ansi16* mdz_ansi_16_create(unsigned short nCapacity, enum mdz_error* penError);

ParameterDescription
nCapacityinitial Capacity of String data in Items
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_16_dyn_init() or invalid
MDZ_ERROR_CAPACITYnCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_ALLOC_FUNCdynamic-memory allocator malloc() function is not set (using mdz_16_dyn_setAllocFunctions())
MDZ_ERROR_ALLOCATIONcould not alocate memory
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
NULLfunction failed
Resultpointer to String for use in other mdz_ansi_16 functions

mdz_ansi_16 Reference

mdz_ansi_16_fromText

Create String including pcText with 0-terminator. This function uses dynamic-memory allocator malloc() function set in mdz_ansi_16_setAllocFunctions()

mdz_Ansi16* mdz_ansi_16_fromText(const char* pcText, size_t nLength, enum mdz_error* penError);

ParameterDescription
pcTexttext to insert during creation. Cannot be NULL, but can contain 0-terminators inside
nLengthlength of pcText, or 0 for pcText length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_16_dyn_init() or invalid
MDZ_ERROR_ITEMSpcText is NULL
MDZ_ERROR_ZERO_COUNTnLength is 0 and pcText is empty (0-terminator)
MDZ_ERROR_BIG_COUNTnLength > maximal possible Capacity
MDZ_ERROR_ALLOC_FUNCdynamic-memory allocator malloc() function is not set (using mdz_16_dyn_setAllocFunctions())
MDZ_ERROR_ALLOCATIONcould not alocate memory
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
NULLfunction failed
Resultpointer to String for use in other mdz_ansi_16 functions

mdz_ansi_16 Reference

mdz_ansi_16_attach

Attach String to pre-allocated pcBuffer of nBufferSize bytes. If penError is not NULL, error will be written there

mdz_Ansi16* mdz_ansi_16_attach(char* pcBuffer, unsigned short nBufferSize, enum mdz_error* penError);

ParameterDescription
pcBufferpointer to pre-allocated buffer to attach
nBufferSizesize of pcBuffer in bytes. Minimal-possible buffer size is returned by mdz_ansi_16_minBufferSize() - in this case Capacity is 0
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApcBuffer is NULL
MDZ_ERROR_CAPACITYnBufferSize < minimal buffer size, returned by mdz_ansi_16_minBufferSize()
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
NULLfunction failed
Resultpointer to String for use in other mdz_ansi_16 functions

mdz_ansi_16 Reference

mdz_ansi_16_destroy

Destroy String. If String is created using mdz_ansi_16_create() - free() function set in mdz_ansi_16_setAllocFunctions() will be used for destroying.

enum mdz_error mdz_ansi_16_destroy(mdz_Ansi16* psAnsi);

ParameterDescription
psAnsipointer to String

ReturnDescription
MDZ_ERROR_FREE_FUNCcould not destroy String created with mdz_ansi_16_create(), because free() function is not set using mdz_ansi_16_setAllocFunctions()
MDZ_ERROR_NONEfunction succeeded

mdz_ansi_16 Reference

mdz_ansi_16_clear

Clear Data of String with setting Size to 0.

void mdz_ansi_16_clear(struct mdz_Ansi16* psAnsi);

ParameterDescription
psAnsipointer to String

mdz_ansi_16 Reference

mdz_ansi_16_minBufferSize

Return size of minimal buffer for attachment using mdz_ansi_16_attach(). Capacity of such a String is 0

unsigned short mdz_ansi_16_minBufferSize(void);

ReturnDescription
0if mdz_ansi_16_init() was not called
Sizeotherwise

mdz_ansi_16 Reference

mdz_ansi_16_maxCapacity

Return size of maximal Capacity

unsigned short mdz_ansi_16_maxCapacity(void);

ReturnDescription
0if mdz_ansi_16_init() was not called
Sizeotherwise

mdz_ansi_16 Reference

mdz_ansi_16_size

Return Size of String Data in Items

unsigned short mdz_ansi_16_size(const mdz_Ansi16* psAnsi);

ParameterDescription
psAnsipointer to String

ReturnDescription
0if psAnsi is NULL
Sizeotherwise

mdz_ansi_16 Reference

mdz_ansi_16_capacity

Return Capacity of string Data in Items

unsigned short mdz_ansi_16_capacity(const mdz_Ansi16* psAnsi);

ParameterDescription
psAnsipointer to String

ReturnDescription
0if psAnsi is NULL
Capacityotherwise

mdz_ansi_16 Reference

mdz_ansi_16_data

Return pointer to String Data.

char* mdz_ansi_16_data(mdz_Ansi16* psAnsi);

ParameterDescription
psAnsipointer to String

ReturnDescription
0if psAnsi is NULL
Dataotherwise

mdz_ansi_16 Reference

mdz_ansi_16_dataConst

Return const pointer to string Data.

const char* mdz_ansi_16_dataConst(const mdz_Ansi16* psAnsi);

ParameterDescription
psAnsipointer to String

ReturnDescription
0if psAnsi is NULL
Dataotherwise

mdz_ansi_16 Reference

mdz_ansi_16_reserve

Reserve nNewCapacity for String using realloc() function set in mdz_ansi_16_setAllocFunctions(). String Size does not change.

enum mdz_error mdz_ansi_16_reserve(mdz_Ansi16** ppsAnsi, unsigned short nNewCapacity);

ParameterDescription
ppsAnsipointer to address of String returned by mdz_ansi_create() or mdz_ansi_create_attached()
nNewCapacitynew capacity in Items to reserve. If nNewCapacity <= current Capacity, there are no changes and MDZ_ERROR_NONE is returned

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATAppsAnsi is NULL or *ppsAnsi is NULL
MDZ_ERROR_CAPACITYcurrent Capacity or nNewCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ATTACHEDString is attached using mdz_ansi_16_attach(), thus cannot be reallocated
MDZ_ERROR_REALLOC_FUNCcould not realloc String created with mdz_ansi_16_create(), because realloc() function is not set using mdz_ansi_16_setAllocFunctions()
MDZ_ERROR_ALLOCATIONString reallocation failed
MDZ_ERROR_NONEfunction succeeded

mdz_ansi_16 Reference

mdz_ansi_16_insert

Insert pcItems into Data from nLeftPos position. Data and pcItems cannot overlap. New Size is 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);

ParameterDescription
ppsAnsipointer to address of String. It should have enough Capacity for insertion of pcItems
nLeftPos0-based position to insert. If nLeftPos == Size, pcItems is appended. nLeftPos > Size is not allowed
pcItemsitems to insert. Cannot be NULL
nCountlength of pcItems to insert, or 0 for pcItems length until 0-terminator
bReserveif mdz_true reserve capacity when there is not enough space for insertion, otherwise mdz_false

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATAppsAnsi is NULL or *ppsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_LEFTnLeftPos > Size
MDZ_ERROR_OVERLAP[Data .. Data + Size + nCount] area and pcItems overlap
MDZ_ERROR_BIG_COUNTSize + nCount > maximal possible Capacity and bReserve is mdz_false
MDZ_ERROR_ATTACHEDString has not enough capacity for insertion, but is attached using mdz_ansi_16_attach(), thus cannot be reallocated
MDZ_ERROR_REALLOC_FUNCcould not realloc String created with mdz_ansi_16_create(), because realloc() function is not set using mdz_ansi_16_setAllocFunctions()
MDZ_ERROR_ALLOCATIONString reallocation failed
MDZ_ERROR_NONEfunction succeeded

mdz_ansi_16 Reference

mdz_ansi_16_append

Append pcItems to Data. Data and pcItems cannot overlap. New Size is written in psAnsi.

enum mdz_error mdz_ansi_16_append(mdz_Ansi16** ppsAnsi, const char* pcItems, size_t nCount, mdz_bool bReserve);

ParameterDescription
ppsAnsipointer to address of String. It should have enough Capacity for appending of pcItems
pcItemsitems to append. Cannot be NULL
nCountlength of pcItems to append, or 0 for pcItems length until 0-terminator
bReserveif mdz_true reserve capacity when there is not enough space for appending, otherwise mdz_false

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATAppsAnsi is NULL or *ppsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_COUNTSize + nCount > maximal possible Capacity or bReserve is mdz_false
MDZ_ERROR_OVERLAP[Data; Data + Size + nCount] area and pcItems overlap
MDZ_ERROR_ATTACHEDString has not enough capacity for appending, but is attached using mdz_ansi_16_attach(), thus cannot be reallocated
MDZ_ERROR_REALLOC_FUNCcould not realloc String created with mdz_ansi_16_create(), because realloc() function is not set using mdz_ansi_16_setAllocFunctions()
MDZ_ERROR_ALLOCATIONString reallocation failed
MDZ_ERROR_NONEfunction succeeded

mdz_ansi_16 Reference

mdz_ansi_16_findSingle

Find first occurrence of cItem. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. If penError is not NULL, error will be written there

unsigned short mdz_ansi_16_findSingle(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, char cItem, enum mdz_error* penError);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of Data
nRightPos0-based end position to search up to. Use Size-1 or USHRT_MAX to search till the end of Data
cItemItem to find
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif cItem not found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_find

Find first occurrence of pcItems using optimized Boyer-Moore-Horspool search. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. If penError is not NULL, error will be written there

unsigned 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of Data
nRightPos0-based end position to search up to. Use Size-1 or USHRT_MAX to search till the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_BIG_COUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif pcItems not found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_rfindSingle

Find last occurrence of cItem. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. If penError is not NULL, error will be written there

unsigned short mdz_ansi_16_rfindSingle(const mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, char cItem, enum mdz_error* penError);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of Data
nRightPos0-based start position to find from right. Use Size-1 or USHRT_MAX to search from the end of Data
cItemItem to find
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif cItem not found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_rfind

Find last occurrence of pcItems using optimized Boyer-Moore-Horspool search. Returns 0-based position of match (if found), or USHRT_MAX if not found or error happened. If penError is not NULL, error will be written there

unsigned 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of Data
nRightPos0-based start position to find from right. Use Size-1 or USHRT_MAX to search from the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_BIG_COUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif pcItems not found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_firstOf

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. If penError is not NULL, error will be written there

unsigned 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of Data
nRightPos0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif no Item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_firstNotOf

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. If penError is not NULL, error will be written there

unsigned 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of Data
nRightPos0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif no Item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_lastOf

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. If penError is not NULL, error will be written there

unsigned 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of Data
nRightPos0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif no Item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_lastNotOf

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. If penError is not NULL, error will be written there

unsigned 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of Data
nRightPos0-based start position to find from right. Use Size-1 or USHRT_MAX to search till the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
USHRT_MAXif no Item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_16 Reference

mdz_ansi_16_removeFrom

Remove nCount Items starting from 0-based nLeftPos position

enum mdz_error mdz_ansi_16_removeFrom(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nCount);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to remove Items from. Use 0 to remove from the beginning of Data
nCountnumber of Items to remove. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_LEFTnLeftPos >= Size
MDZ_ERROR_BIG_COUNTnCount is bigger than remove area (between nLeftPos and Size)
MDZ_ERROR_NONEfunction succeeded or Size is 0 (String is empty)

mdz_ansi_16 Reference

mdz_ansi_16_remove

Remove all ocurrences of pcItems with lenth nCount, residing between nLeftPos and nRightPos

enum mdz_error mdz_ansi_16_remove(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount, mdz_bool bFromLeft);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to remove pcItems from. Use 0 to search from the beginning of Data
nRightPos0-based end position to remove pcItems up to. Use Size-1 to search till the end of Data
pcItemsitems to remove. Cannot be NULL
nCountlength of pcItems to remove, or 0 for pcItems length until 0-terminator
bFromLeftmdz_true if search for pcItems to remove from left side, otherwise from right

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_BIG_COUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded or Size is 0 (String is empty)

mdz_ansi_16 Reference

mdz_ansi_16_trimLeft

Remove Items which are contained in pcItems from left, until first Item non-contained in pcItems is reached.

enum mdz_error mdz_ansi_16_trimLeft(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to trim Items from left. Use 0 to trim from the beginning of Data
nRightPos0-based end position to trim Items up to. Use Size-1 to trim till the end of Data
pcItemsitems to trim. Cannot be NULL
nCountlength of pcItems to trim, or 0 for pcItems length until 0-terminator

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded or Size is 0 (String is empty)

mdz_ansi_16 Reference

mdz_ansi_16_trimRight

Remove Items which are contained in pcItems from right, until first Item non-contained in pcItems is reached.

enum mdz_error mdz_ansi_16_trimRight(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
psAnsipointer to String
nLeftPos0-based end position to trim Items up to. Use 0 to trim till the beginning of Data
nRightPos0-based start position to trim Items from right. Use Size-1 to trim from the end of Data
pcItemsitems to trim. Cannot be NULL
nCountlength of pcItems to trim, or 0 for pcItems length until 0-terminator

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded or Size is 0 (String is empty)

mdz_ansi_16 Reference

mdz_ansi_16_trim

Remove Items which are contained in pcItems from left and from right, until first non-contained in pcItems Item is reached.

enum mdz_error mdz_ansi_16_trim(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to trim Items from left. Use 0 to trim from the beginning of Data
nRightPos0-based start position to trim Items from right. Use Size-1 to trim from the end of Data
pcItemsitems to trim. Cannot be NULL
nCountlength of pcItems to trim, or 0 for pcItems length until 0-terminator

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded or Size is 0 (String is empty)

mdz_ansi_16 Reference

mdz_ansi_16_equal

Compare content of Data with pcItems on equalty by length and content. If penError is not NULL, error will be written there

enum mdz_ansi_compare_result mdz_ansi_16_equal(const mdz_Ansi16* psAnsi, const char* pcItems, size_t nCount, enum mdz_error* penError);

ParameterDescription
psAnsipointer to String
pcItemsitems to compare. Cannot be NULL
nCountlength of pcItems to compare, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
MDZ_COMPARE_EQUAL or MDZ_COMPARE_NONEQUALResult of comparison

mdz_ansi_16 Reference

mdz_ansi_16_compare

Compare content of Data with pcItems. If penError is not NULL, error will be written there

enum 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to compare from left. Use 0 to compare from the beginning of Data
pcItemsitems to compare. Cannot be NULL
nCountlength of pcItems to compare, or 0 for pcItems length until 0-terminator
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_LEFTnLeftPos >= Size
MDZ_ERROR_BIG_COUNTnCount is bigger than compare area (between nLeftPos and Size)
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
MDZ_COMPARE_EQUAL or MDZ_COMPARE_NONEQUALResult of comparison

mdz_ansi_16 Reference

mdz_ansi_16_count

Counts number of pcItems substring occurences in Data. If penError is not NULL, error will be written there

size_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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of Data
nRightPos0-based end position to search up to. Use Size-1 to search till the end of Data
pcItemsitems to find. Cannot be NULL
nCountlength of pcItems to find, or 0 for pcItems length until 0-terminator
bAllowOverlappedmdz_true if overlapped substrings should be counted, otherwise mdz_false
bFromLeftmdz_true if search for pcItems to count from left side, otherwise from right
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_BIG_COUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
SIZE_MAXif error happened
Resultcount of substring occurences. 0 if not found

mdz_ansi_16 Reference

mdz_ansi_16_replace

Replace every occurence of pcItemsBefore with pcItemsAfter in Data. There should be enough Capacity for 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);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of Data
nRightPos0-based end position to search up to. Use Size-1 to search till the end of Data
pcItemsBeforeitems to find. Cannot be NULL
nCountBeforelength of pcItemsBefore to find, or 0 for pcItemsBefore length until 0-terminator
pcItemsAfterpointer to items to replace with. Can be NULL (in this case nCountAfter is treated as 0)
nCountAfterlength of pcItemsAfter to replace, or 0 for pcItems length until 0-terminator
bFromLeftmdz_true if search for pcItemsBefore to replace from left side, otherwise from right
enReplacementTypetype of replacement when nCountAfter > nCountBefore (thus Size is growing). For now only MDZ_ANSI_REPLACE_DUAL is supported (please refer to description of mdz_ansi_replace_type enum)

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_ITEMSpcItemsBefore is NULL
MDZ_ERROR_ZERO_COUNTnCountBefore is 0
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos > nRightPos
MDZ_ERROR_BIG_COUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_OVERLAPData overlaps with pcItemsBefore, or Data overlaps with pcItemsAfter
MDZ_ERROR_BIG_REPLACEnew Size after replacement > Capacity
MDZ_ERROR_OVERLAP_REPLACEData after replacement - overlaps with pcItemsBefore, or Data after replacement - overlaps with pcItemsAfter
MDZ_ERROR_NONEfunction succeeded or Size is 0 (String is empty)

mdz_ansi_16 Reference

mdz_ansi_16_reverse

Reverses Items in string, like "1234" into "4321".

enum mdz_error mdz_ansi_16_reverse(mdz_Ansi16* psAnsi, unsigned short nLeftPos, unsigned short nRightPos);

ParameterDescription
psAnsipointer to String
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of Data
nRightPos0-based end position to search up to. Use Size-1 to search till the end of Data

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_16_init() or invalid
MDZ_ERROR_DATApsAnsi is NULL
MDZ_ERROR_CAPACITYCapacity > maximal-possible capacity, returned by mdz_ansi_16_maxCapacity()
MDZ_ERROR_BIG_SIZESize > Capacity
MDZ_ERROR_TERMINATORthere is no 0-terminator on Data[Size] position
MDZ_ERROR_BIG_RIGHTnRightPos >= Size
MDZ_ERROR_BIG_LEFTnLeftPos >= nRightPos
MDZ_ERROR_NONEfunction succeeded

mdz_ansi_16 Reference
Software Development. Strive for the Impossible to achieve Excellence.
Copyright Ⓒ 2017 - 2025 maxdz Software GmbH. All rights reserved.
Site content is generated using mdzWebSiteGenerator