MbSubStrCpy
Syntax
void mbsubstr_cpy(char dest[], char src[], long srcStart, long len);
void mbsubstr_cpy_off(char dest[], long destOffset, char src[], long srcStart, long len);
Function
mbsubstr_cpycopies a substring ofsrctodest.lenindicates the number ofcharactersthat shall be copied; use -1 to indicate that as much shall be copied intodestas will fit (maximum until the end ofsrc). The function ensures that there is a terminating 0 byte; but in contrast tosubstr_cpy/substr_cpy_off, that byte is not counted intolen. mbsubstr_cpy_offoverwrites characters in the destination buffer starting at thecharacteroffsetdestOffset.
Parameters
dest Destination buffer
src
Source string
srcStart
Start index incharactersinsrcof substring
len
Number ofcharactersto be copied, or -1 to copy as much as possible
destOffset
Offset incharactersinto the destination buffer
Return Values
—
char s1[50] = "eine grüne "; // german for 'a green'char s2[20] = "schöne Türen"; // german for 'beautiful doors'mbsubstr_cpy_off(s1, 11, s2, 7, 3);write("%s", s1); // eine grüne Tür (german for 'a green door')
substr_cpy | substr_cpy_off | mbstrncpy | mbstrlen | mbstrncmp | mbstrstr