Skip to content

mdz_ansi_alg_count

Maksym Dzyubenko edited this page Oct 6, 2024 · 5 revisions

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,
  mdz_bool bAllowOverlapped,
  mdz_bool bFromLeft,
  enum mdz_error* penError);

Parameter Description
pcData pointer to string
nLeftPos 0-based start position to search from left. Use 0 to search from the beginning of string
nRightPos 0-based end position to search up to. Use Size-1 to search till the end of string
pcItems items to find. Cannot be NULL
nCount number of items to find. Cannot be 0
bAllowOverlapped mdz_true if overlapped substrings should be counted, otherwise mdz_false
bFromLeft mdz_true if search for items to 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_alg_init() or invalid
MDZ_ERROR_DATA pcData is NULL
MDZ_ERROR_ITEMS pcItems is NULL
MDZ_ERROR_ZERO_COUNT nCount is 0
MDZ_ERROR_BIG_RIGHT nRightPos is SIZE_MAX
MDZ_ERROR_BIG_LEFT nLeftPos > nRightPos
MDZ_ERROR_BIG_COUNT nCount is bigger than search area (between nLeftPos and nRightPos)
MDZ_ERROR_NONE function succeeded
Return Description
SIZE_MAX if error happened
Result count of substring occurences. 0 if not found
mdz_ansi_alg API Reference is generated using mdzApiRefGenerator.