Mikroelektronika MIKROE-350 データシート

ページ / 526
strncmp
strncpy
strpbrk
strrchr
493
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function strncmp(dim byref s1, s2 as string[100], dim len as
byte
as short
Description
The function lexicographically compares the first 
len
words 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 first pair of words that differ in the strings being compared (within
first 
len
words).
Prototype
sub procedure strncpy(dim byref s1, s2 as string[100], dim size
as 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.
Prototype
sub function strpbrk(dim byref s1, s2 as string[100]) as word
Description
The function searches 
s1
for the first occurrence of any character from the
string 
s2.
The null terminator is not included in the search. The function returns
an index of the matching character in 
s1
. If 
s1
contains no characters from 
s2
,
the function returns 
0xFFFF
.
Prototype
sub function strrchr(dim byref as string[100], dim ch as byte)
as word
Description
The function searches the string 
s
for the last occurrence of the character 
ch
.
The null character terminating 
s
is not included in the search. The function
returns an index of the last 
ch
found in 
s
; if no matching character was found,
the function returns 
0xFFFF
.