Skip to content

mdz_ansi_alg_trim

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

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

Parameter Description
pcData pointer to string. It should end with 0-terminator
pnDataSize pointer to current Size. If removal succeed, new size is returned here
nLeftPos 0-based start position to trim item(s) from left. Use 0 to trim from the beginning of string
nRightPos 0-based start position to trim item(s) from right. Use Size-1 to trim from the end of string
pcItems items to trim. Cannot be NULL
nCount number of items to trim. Cannot be 0
Return Description
MDZ_ERROR_LICENSE license is not initialized using mdz_ansi_alg_init() or invalid
MDZ_ERROR_DATA pcData is NULL
MDZ_ERROR_SIZE pnDataSize is NULL
MDZ_ERROR_ZERO_SIZE Size is 0 (string is empty)
MDZ_ERROR_TERMINATOR there is no 0-terminator in the end of pcData ([Size] position)
MDZ_ERROR_ITEMS pcItems is NULL
MDZ_ERROR_ZERO_COUNT nCount is 0
MDZ_ERROR_BIG_RIGHT nRightPos >= Size
MDZ_ERROR_BIG_LEFT nLeftPos > nRightPos
MDZ_ERROR_NONE function succeeded, new size is written in pnDataSize
mdz_ansi_alg API Reference is generated using mdzApiRefGenerator.