Skip to content

mdz_ansi_replace_async

Maksym Dzyubenko edited this page Feb 7, 2024 · 1 revision

Replace every occurence of pcItemsBefore with pcItemsAfter. There should be enough Capacity for replacing data.

mdz_bool mdz_ansi_replace_async(
  struct mdz_Ansi* pAnsi,
  size_t nLeftPos,
  size_t nRightPos,
  const char* pcItemsBefore,
  size_t nCountBefore,
  const char* pcItemsAfter,
  size_t nCountAfter,
  mdz_bool bReserve,
  struct mdz_asyncData* pAsyncData);

Synchronous version:
mdz_ansi_replace(pAnsi, nLeftPos, nRightPos, pcItemsBefore, nCountBefore, pcItemsAfter, nCountAfter, bReserve);

Parameter Description
pAnsi pointer to astring returned by mdz_ansi_create() or mdz_ansi_create_attached()
nLeftPos 0-based start position to search for replace from. Use 0 to search from the beginning of string
nRightPos 0-based end position to search for replace up to. Use Size-1 or -1 to seach till the end of string
pcItemsBefore pointer to items to replace
nCountBefore number of items to replace or 0 if pcItems until 0-terminator should be used
pcItemsAfter pointer to items to replace with
nCountAfter number of items to replace with or 0 if pcItems until 0-terminator should be used
bReserve if mdz_true reserve capacity when there is not enough space for replacement, otherwise mdz_false
pAsyncData pointer to shared async data for asynchronous call, or NULL if call should be synchronous
Return Description
mdz_false if pAnsi == NULL
mdz_false if bReserve == mdz_true and there is not enough capacity for inserted data, but m_pData is attached using mdz_ansi_attachData() (MDZ_ERROR_ATTACHED)
mdz_false if bReserve == mdz_false and there is not enough free Capacity in the string (MDZ_ERROR_CAPACITY)
mdz_true if pcItemsBefore == NULL (MDZ_ERROR_ITEMS), or nCountBefore == 0 and pcItemsBefore[0] == 0 (MDZ_ERROR_ZEROCOUNT), or nLeftPos > nRightPos (MDZ_ERROR_BIGLEFT), or nRightPos >= Size (MDZ_ERROR_BIGRIGHT), or nCountBefore is too big (MDZ_ERROR_BIGCOUNT). No replacements are made
mdz_true operation succeeded
mdz_ansi API Reference is generated using mdzApiRefGenerator.

mdz_string functions

mdz_ansi functions

mdz_utf8 functions

mdz_wchar functions

mdz_utf16 functions

mdz_utf32 functions

mdz_string API Reference is generated using mdzApiRefGenerator.
Clone this wiki locally