User manual

677
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
strcpy
Prototype
procedure strcpy(var s1, s2 : string);
Description The function copies the value of the string s2 to the string s1 and appends a null character to the end
of s1.
Example
txt := ‘mikroElektronika’;
txt_sub := ‘mikr’;
strcpy(txt,txt_sub); // copies string ‘txt_sub’ to ‘txt’
strlen
Prototype
function strlen(var s : string) : word;
Description The function returns the length, in words, of the string s. The length does not include the null terminating
character.
Example
txt := ‘mikroElektronika’;
res = strlen(txt); // calculates the length of the ‘txt’ string, result = 16
strncat
Prototype
procedure strncat(var s1, s2 : string; size : word);
Description The function appends at most size characters from the string s2 to the string s1 and terminates s1
with a null character. If s2 is shorter than the size characters, s2 is copied up to and including the
null terminating character.
Example
txt := ‘mikroElektronika’;
txt_sub := ‘mikr’;
txt[5] := 0;
strncat(txt,txt_sub,4); // routine appends rst 4 characters from the
string ‘txt_sub’ at the place of rst null character in the ‘txt’ string
strncpy
Prototype
procedure strncpy(var s1, s2 : string; size : word);
Description The function copies at most size characters from the string s2 to the string s1. If s2 contains
fewer characters than size, s1 is padded out with null characters up to the total length of the size
characters.
Example
txt := ‘mikroElektronika’;
txt_sub := ‘mikr’;
strncpy(txt,txt_sub,4); // copies rst 4 characters form the string ‘txt_
sub’ to ‘txt’