Skip to content

mdz_ansi_alg_find

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

Find first occurrence of pcItems in pcData using optimized Boyer-Moore-Horspool search. 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_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
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 pcItems not found or error happened
Result 0-based position of first match
mdz_ansi_alg API Reference is generated using mdzApiRefGenerator.