User manual

673
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
String Library
mikroPascal PRO for dsPIC30/33 and PIC24 includes a library which automatizes string related tasks.
Library Functions
- memchr
- memcmp
- memcpy
- memmove
- memset
- strcat
- strcat2
- strchr
- strcmp
- strcpy
- strlen
- strncat
- strncpy
- strspn
- strncmp
- strstr
- strcspn
- strpbrk
- strrchr
- ltrim
- rtrim
- strappendpre
- strappendsuf
- length
memchr
Prototype
function memchr(p : ^byte; ch : byte; n : word) : word;
Description The function locates the rst occurrence of the byte ch in the initial n words of memory area starting
at the address p. The function returns the offset of this occurrence from the memory address p or
0xFFFF if ch was not found.
For the parameter p you can use either a numerical value (literal/variable/constant) indicating memory
address or a dereferenced value of an object, for example @mystring or @PORTB.
Example
txt := ‘mikroElektronika’;
res := memchr(@txt, ‘e’, 16); // example locates rst occurrence of the
letter ‘e’ in the string ‘txt’ in the rst 16 characters of the string