User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
676
strcat2
Prototype
procedure strcat2(var l1, s1, s2 : string);
Description The procedure adjoins string s2 at the end of the string s1, or at the rst null character of the s1, and
places the result string into l string.
Example
txt := ‘mikroElektronika’;
txt_sub := ‘_Test’;
l1 := string[21];
strcat2(l1, txt, txt_sub); // routine will adjoin strings txt and txt_sub
and place the result into l; l = mikroElektronika_Test
strchr
Prototype
function strchr(var s : string; ch : byte) : word;
Description The function searches the string s for the rst occurrence of the character ch. The null character
terminating s is not included in the search.
The function returns the position (index) of the rst character ch found in s; if no matching character
was found, the function returns 0xFFFF.
Example
txt := ‘mikroElektronika’;
res := strchr(txt, ‘E’); // routine will locate the character ‘E’ in the
‘txt’ string, and return the position of the character
strcmp
Prototype
function strcmp(var s1, s2 : string) : integer;
Description The function lexicographically compares the contents of the strings s1 and s2 and returns a value
indicating their relationship:
Value Meaning
< 0 s1 “less than” s2
= 0 s1 “equal to” s2
> 0 s1 “greater than” s2
The value returned by the function is determined by the difference between the values of the rst pair
of words that differ in the strings being compared.
Example
txt := ‘mikroElektronika’;
txt_sub := ‘mikr’;
res := strcmp(txt,txt_sub); // compares strings ‘txt’ and ‘txt_sub’ and
returns returns a difference between the rst differing characters, in this
case 69