Site Logo

maxdz Software GmbH

en | de
Home

Team

Produkte

mdz_ansi_alg

mdz_ui

mdz_xml

mdz_string

mdz_vector

mdzWebSiteGenerator

mdzTennisTracker

Shop

Gesetzliches

Kontakte

mdz_ansi_alg Overview and Reference

mdz_ansi_alg - very lightweight and versatile C library, containing string-processing algorithms for handling contiguous single-byte (ASCII/ANSI) strings. Source code of library is highly-portable, conforms to ANSI C 89/90 Standard. Builds for Win32/Win64, Linux, FreeBSD, Android, macOS are available.

mdz_ansi_alg Advantages

1. High portability: the whole code conforms to ANSI C 89/90 Standard.

2. Little dependencies: basically, mdz_ansi_alg functions are only dependent on standard C-library functions. It means you can use library in your code without any further dependencies except standard platform libraries/APIs.

3. Fast: Our functions are very fast, concerning operations like searching, insertion, deletion, etc. especially for very large (like hundreds of megabytes or gigabytes) strings.

4. Flexibilty: nearly all library functions contain not only "left position" but also "right position" parameters to limit processed area from right. Also library contains more string functions than according STL, boost or glib analogs have.

5. Extended error-checking: all functions use strict error-checking and return distinct error codes pointing the problem precisely.

6. Extended control: functions do only explicit operations. It means for example, when "insert" function is called - it will return error if there is not enough capacity in string. No implicit reservations will be made.

7. No memory overhead: functions are algorithms for processing input data. There are no memory allocations happen inside functions and no dynamic memory use.

Please refer to mdz_ansi_alg Wiki for API details.


mdz_ansi_alg API Reference


mdz_ansi_alg API Reference is generated using mdzApiRefGenerator.

mdz_ansi_alg General Information and Functions

mdz_ansi_alg is algorithms library for contiguous single-byte string, containing ASCII (0..127) and "ANSI" (128 - 255) characters.
There are no dynamic memory-allocations happen inside functions, only data and items buffers passed from outside are processed.

String may contain 0-terminators ('\0') inside, and must end with 0-terminator.

Capacity - how many bytes of memory is reserved for string content. Capacity does not include 0-terminator byte, thus reserved memory should be at least 1 byte bigger than Capacity.
Size - how many characters are actually residing in a string.

Init functions:

mdz_ansi_alg_init
mdz_ansi_alg_insert

Find functions:

mdz_ansi_alg_findSingle
mdz_ansi_alg_find
mdz_ansi_alg_rfindSingle
mdz_ansi_alg_rfind
mdz_ansi_alg_firstOf
mdz_ansi_alg_firstNotOf
mdz_ansi_alg_lastOf
mdz_ansi_alg_lastNotOf

Remove functions:

mdz_ansi_alg_removeFrom
mdz_ansi_alg_remove
mdz_ansi_alg_trimLeft
mdz_ansi_alg_trimRight
mdz_ansi_alg_trim

Miscellaneous functions:

mdz_ansi_alg_compare
mdz_ansi_alg_count


mdz_ansi_alg_init

Initializes mdz_ansi_alg library and license. This function should be called before any other function of the library.

mdz_bool mdz_ansi_alg_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_alg Reference

mdz_ansi_alg_insert

Insert pcItems into pcData from nLeftPos position. pcData and pcItems cannot overlap. New size is returned in pnDataSize.
Size and capacity - do not include 0-terminator; thus size and capacity of empty string with no free space are 0

enum mdz_error mdz_ansi_alg_insert(char* pcData, size_t* pnDataSize, size_t nDataCapacity, size_t nLeftPos, const char* pcItems, size_t nCount);

ParameterDescription
pcDatapointer to string. It should end with 0-terminator and have enough capacity for insertion of pcItems
pnDataSizepointer to current Size. Size is 0 for empty string. If insertion succeeded, new size is returned here
nDataCapacitymaximal capacity of pcData buffer. nDataCapacity does not include 0-terminator byte, thus pcData buffer should be at least 1 byte bigger than nDataCapacity
nLeftPos0-based position to insert. If nLeftPos == Size items are appended. nLeftPos > Size is not allowed
pcItemsitems to insert. Cannot be NULL
nCountnumber of items to insert. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZEpnDataSize is NULL
MDZ_ERROR_CAPACITYnDataCapacity is 0 (no space for insertion) or SIZE_MAX (no space for 0-terminator)
MDZ_ERROR_TERMINATORthere is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIGLEFTnLeftPos > Size
MDZ_ERROR_BIGCOUNTSize + nCount > nDataCapacity
MDZ_ERROR_OVERLAP[pcData .. pcData + Size + nCount] area and pcItems overlap
MDZ_ERROR_NONEfunction succeeded, new size is written in pnDataSize

mdz_ansi_alg Reference

mdz_ansi_alg_findSingle

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

size_t mdz_ansi_alg_findSingle(const char* pcData, size_t nLeftPos, size_t nRightPos, char cItem, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos0-based end position to search up to. Use Size-1 to search till the end of string
cItemcharacter 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_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

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

mdz_ansi_alg Reference

mdz_ansi_alg_find

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

size_t mdz_ansi_alg_find(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_ansi_find_method enFindMethod, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos0-based end position to search up to. Use Size-1 to search till the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
enFindMethodfind method to use. See details in mdz_ansi_find_method description (mdz_ansi_find_method.h header)
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_FIND_METHODenFindMethod >= MDZ_ANSI_FIND_LAST
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_BIGCOUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded

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

mdz_ansi_alg Reference

mdz_ansi_alg_rfindSingle

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

size_t mdz_ansi_alg_rfindSingle(const char* pcData, size_t nLeftPos, size_t nRightPos, char cItem, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to search from the end of string
cItemcharacter 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_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

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

mdz_ansi_alg Reference

mdz_ansi_alg_rfind

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

size_t mdz_ansi_alg_rfind(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_ansi_find_method enFindMethod, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to search from the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
enFindMethodfind method to use. See details in mdz_ansi_find_method description (mdz_ansi_find_method.h header)
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_FIND_METHODenFindMethod >= MDZ_ANSI_FIND_LAST
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_BIGCOUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded

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

mdz_ansi_alg Reference

mdz_ansi_alg_firstOf

Find first occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or SIZE_MAX if not found or error happened. If penError is not NULL, error will be written there

size_t mdz_ansi_alg_firstOf(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to search till the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
SIZE_MAXif no item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_alg Reference

mdz_ansi_alg_firstNotOf

Find first non-occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or SIZE_MAX if not found or error happened. If penError is not NULL, error will be written there

size_t mdz_ansi_alg_firstNotOf(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to search till the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
SIZE_MAXif no item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_alg Reference

mdz_ansi_alg_lastOf

Find last occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or SIZE_MAX if not found or error happened. If penError is not NULL, error will be written there

size_t mdz_ansi_alg_lastOf(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to search till the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
SIZE_MAXif no item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_alg Reference

mdz_ansi_alg_lastNotOf

Find last non-occurrence of any item of pcItems in string. Returns 0-based position of match (if found), or SIZE_MAX if not found or error happened. If penError is not NULL, error will be written there

size_t mdz_ansi_alg_lastNotOf(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based end position to find up to. Use 0 to search till the beginning of string
nRightPos0-based start position to find from right. Use Size-1 to search till the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
SIZE_MAXif no item of pcItems found or error happened
Result0-based position of first match

mdz_ansi_alg Reference

mdz_ansi_alg_removeFrom

Remove nCount item(s) starting from 0-based nLeftPos position

enum mdz_error mdz_ansi_alg_removeFrom(char* pcData, size_t* pnDataSize, size_t nLeftPos, size_t nCount);

ParameterDescription
pcDatapointer to string. It should end with 0-terminator
pnDataSizepointer to current Size. If removal succeed, new size is returned here
nLeftPos0-based start position to remove item(s) from. Use 0 to remove from the beginning of string
nCountnumber of item(s) to remove. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZEpnDataSize is NULL
MDZ_ERROR_ZERO_SIZESize is 0 (string is empty)
MDZ_ERROR_TERMINATORthere is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIGLEFTnLeftPos >= Size
MDZ_ERROR_BIGCOUNTnLeftPos + nCount > Size
MDZ_ERROR_NONEfunction succeeded, new size is written in pnDataSize

mdz_ansi_alg Reference

mdz_ansi_alg_remove

Remove all ocurrences of nCount item(s) matching to pcItems, residing between nLeftPos and nRightPos

enum mdz_error mdz_ansi_alg_remove(char* pcData, size_t* pnDataSize, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
pcDatapointer to string. It should end with 0-terminator
pnDataSizepointer to current Size. If removal succeed, new size is returned here
nLeftPos0-based start position to remove item(s) from. Use 0 to search from the beginning of string
nRightPos0-based end position to remove item(s) up to. Use Size-1 to search till the end of string
pcItemsitems to remove. Cannot be NULL
nCountnumber of item(s) to remove. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZEpnDataSize is NULL
MDZ_ERROR_ZERO_SIZESize is 0 (string is empty)
MDZ_ERROR_TERMINATORthere is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIGRIGHTnRightPos >= Size
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_BIGCOUNTnCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONEfunction succeeded, new size is written in pnDataSize

mdz_ansi_alg Reference

mdz_ansi_alg_trimLeft

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

enum mdz_error mdz_ansi_alg_trimLeft(char* pcData, size_t* pnDataSize, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
pcDatapointer to string. It should end with 0-terminator
pnDataSizepointer to current Size. If removal succeed, new size is returned here
nLeftPos0-based start position to trim item(s) from left. Use 0 to trim from the beginning of string
nRightPos0-based end position to trim item(s) up to. Use Size-1 to trim till the end of string
pcItemsitems to trim. Cannot be NULL
nCountnumber of items to trim. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZEpnDataSize is NULL
MDZ_ERROR_ZERO_SIZESize is 0 (string is empty)
MDZ_ERROR_TERMINATORthere is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIGRIGHTnRightPos >= Size
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded, new size is written in pnDataSize

mdz_ansi_alg Reference

mdz_ansi_alg_trimRight

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

enum mdz_error mdz_ansi_alg_trimRight(char* pcData, size_t* pnDataSize, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
pcDatapointer to string. It should end with 0-terminator
pnDataSizepointer to current Size. If removal succeed, new size is returned here
nLeftPos0-based end position to trim item(s) up to. Use 0 to trim till the beginning of string
nRightPos0-based start position to trim item(s) from right. Use Size-1 to trim from the end of string
pcItemsitems to trim. Cannot be NULL
nCountnumber of items to trim. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZEpnDataSize is NULL
MDZ_ERROR_ZERO_SIZESize is 0 (string is empty)
MDZ_ERROR_TERMINATORthere is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIGRIGHTnRightPos >= Size
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded, new size is written in pnDataSize

mdz_ansi_alg Reference

mdz_ansi_alg_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_alg_trim(char* pcData, size_t* pnDataSize, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount);

ParameterDescription
pcDatapointer to string. It should end with 0-terminator
pnDataSizepointer to current Size. If removal succeed, new size is returned here
nLeftPos0-based start position to trim item(s) from left. Use 0 to trim from the beginning of string
nRightPos0-based start position to trim item(s) from right. Use Size-1 to trim from the end of string
pcItemsitems to trim. Cannot be NULL
nCountnumber of items to trim. Cannot be 0

ReturnDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZEpnDataSize is NULL
MDZ_ERROR_ZERO_SIZESize is 0 (string is empty)
MDZ_ERROR_TERMINATORthere is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is 0
MDZ_ERROR_BIGRIGHTnRightPos >= Size
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_NONEfunction succeeded, new size is written in pnDataSize

mdz_ansi_alg Reference

mdz_ansi_alg_compare

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

enum mdz_ansi_compare_result mdz_ansi_alg_compare(const char* pcData, size_t nDataSize, size_t nLeftPos, const char* pcItems, size_t nCount, mdz_bool bPartialCompare, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nDataSizeSize of pcData
nLeftPos0-based start position to compare from left. Use 0 to compare from the beginning of string
pcItemsitems to compare. Cannot be NULL
nCountnumber of items to compare. Cannot be 0
bPartialCompareif mdz_true compare only nCount items, otherwise compare full strings
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_SIZESize is 0 (empty string)
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_BIGLEFTnLeftPos >= Size
MDZ_ERROR_BIGCOUNTnLeftPos + nCount > Size
MDZ_ERROR_NONEfunction succeeded

ReturnDescription
MDZ_COMPARE_EQUAL or MDZ_COMPARE_NONEQUALResult of comparison

mdz_ansi_alg Reference

mdz_ansi_alg_count

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

size_t mdz_ansi_alg_count(const char* pcData, size_t nLeftPos, size_t nRightPos, const char* pcItems, size_t nCount, enum mdz_ansi_find_method enFindMethod, mdz_bool bAllowOverlapped, enum mdz_error* penError);

ParameterDescription
pcDatapointer to string
nLeftPos0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos0-based end position to search up to. Use Size-1 to search till the end of string
pcItemsitems to find. Cannot be NULL
nCountnumber of items to find. Cannot be 0
enFindMethodfind method to use. See details in mdz_ansi_find_method description (mdz_ansi_find_method.h header)
bAllowOverlappedmdz_true if overlapped substrings should be counted, otherwise mdz_false
penErrorif not NULL, error will be written there. There are following errors possible:
ValueDescription
MDZ_ERROR_LICENSElicense is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATApcData is NULL
MDZ_ERROR_ITEMSpcItems is NULL
MDZ_ERROR_ZERO_COUNTnCount is NULL
MDZ_ERROR_FIND_METHODenFindMethod >= MDZ_ANSI_FIND_LAST
MDZ_ERROR_BIGRIGHTnRightPos is SIZE_MAX
MDZ_ERROR_BIGLEFTnLeftPos > nRightPos
MDZ_ERROR_BIGCOUNTnCount 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_alg Reference
Softwareentwicklung. Strebe nach Unmöglichen, um Hervorragendes zu erreichen.
Copyright Ⓒ 2017 - 2024 maxdz Software GmbH. All rights reserved.
Site content is generated using mdzWebSiteGenerator