WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
osal_string

函数

int osal_memncmp (const void *buf1, const void *buf2, unsigned long size)
 Compare memory areas.
 
int osal_strcmp (const char *s1, const char *s2)
 Compare two strings.
 
int osal_strncmp (const char *s1, const char *s2, unsigned long size)
 Compare two strings.
 
int osal_strcasecmp (const char *s1, const char *s2)
 Compare two strings ignoring case.
 
int osal_strncasecmp (const char *s1, const char *s2, unsigned long size)
 Compare two strings ignoring case.
 
char * osal_strchr (const char *s, int n)
 Locate character in string.
 
char * osal_strnchr (const char *s, int count, int c)
 Find a character in a length limited string.
 
char * osal_strrchr (const char *s, int c)
 Find the last occurrence of a character in a string.
 
char * osal_strstr (const char *s1, const char *s2)
 Locate a substring.
 
char * osal_strnstr (const char *s1, const char *s2, int n)
 Locate a substring in a length limited string.
 
unsigned int osal_strlen (const char *s)
 Calculate the length of a string.
 
unsigned int osal_strnlen (const char *s, unsigned int size)
 Determine the length of a fixed-size string.
 
char * osal_strpbrk (const char *s1, const char *s2)
 Search a string for any of a set of bytes.
 
char * osal_strsep (char **s, const char *ct)
 Extract token from string.
 
unsigned int osal_strspn (const char *s, const char *accept)
 Get length of a prefix substring.
 
unsigned int osal_strcspn (const char *s, const char *reject)
 Get length of a prefix substring.
 
void * osal_memscan (void *addr, int c, int size)
 Find a character in an area of memory.
 
int osal_memcmp (const void *cs, const void *ct, int count)
 Compare two areas of memory.
 
void * osal_memchr (const void *s, int c, int n)
 Find a character in an area of memory.
 
void * osal_memchr_inv (const void *s, int c, int n)
 Find an unmatching character in an area of memory.
 
unsigned long long osal_strtoull (const char *cp, char **endp, unsigned int base)
 Convert a string to an unsigned long long integer.
 
unsigned long osal_strtoul (const char *cp, char **endp, unsigned int base)
 Convert a string to an unsigned long integer.
 
long osal_strtol (const char *cp, char **endp, unsigned int base)
 Convert a string to a long integer.
 
long long osal_strtoll (const char *cp, char **endp, unsigned int base)
 Convert a string to a long long integer.
 

详细描述

函数说明

◆ osal_memchr()

void * osal_memchr ( const void *  s,
int  c,
int  n 
)

Find a character in an area of memory.

Description:
This API is used to find a character in an area of memory.
参数
s[in] The memory area.
c[in] The byte to search for.
n[in] The size of the area.
返回
Returns the address of the first occurrence of c, or NULL if c is not found.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_memchr_inv()

void * osal_memchr_inv ( const void *  s,
int  c,
int  n 
)

Find an unmatching character in an area of memory.

Description:
This API is used to find an unmatching character in an area of memory.
参数
s[in] The memory area.
c[in] Find a character other than c.
n[in] The size of the area.
返回
Returns the address of the first character other than c, or NULL if the whole buffer contains just c.
Support System:
linux liteos.

◆ osal_memcmp()

int osal_memcmp ( const void *  cs,
const void *  ct,
int  count 
)

Compare two areas of memory.

Description:
This API is used to compare two areas of memory.
参数
cs[in] One area of memory.
ct[in] Another area of memory.
count[in] The size of the area.
返回
Returns an integer less than, equal to, or greater than zero if the first count bytes of cs is found, respectively, to be less than, to match, or be greater than the first count bytes of ct.
Support System:
linux liteos freertos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_memncmp()

int osal_memncmp ( const void *  buf1,
const void *  buf2,
unsigned long  size 
)

Compare memory areas.

Description:
This API is used to compare the size bytes of the memory areas buf1 and buf2.
参数
buf1[in] the memory areas to be compared.
buf2[in] the memory areas to be compared.
size[in] the size of the memory areas.
返回
Returns an integer less than, equal to, or greater than zero if the first n bytes of buf1 is found, respectively, to be less than, to match, or be greater than the first n bytes of buf2.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_memscan()

void * osal_memscan ( void *  addr,
int  c,
int  size 
)

Find a character in an area of memory.

Description:
This API is used to find a character in an area of memory.
参数
addr[in] The memory area.
c[in] The byte to search for.
size[in] The size of the area.
返回
Returns the address of the first occurrence of c, or 1 byte past the area if c is not found.
Support System:
linux liteos.

◆ osal_strcasecmp()

int osal_strcasecmp ( const char *  s1,
const char *  s2 
)

Compare two strings ignoring case.

Description:
This API is used to compare strings s1 and s2 byte-by-byte, ignoring the case of the characters.
参数
s1[in] the string to be compared.
s2[in] the string to be compared.
返回
Returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.
Support System:
linux liteos freertos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strchr()

char * osal_strchr ( const char *  s,
int  n 
)

Locate character in string.

Description:
This API is used to locate character in string.
参数
s[in] the string to be searched.
n[in] the character to search for.
返回
Returns a pointer to the first occurrence of the character n in the string s.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strcmp()

int osal_strcmp ( const char *  s1,
const char *  s2 
)

Compare two strings.

Description:
This API is used to compare two strings.
参数
s1[in] the string to be compared.
s2[in] the string to be compared.
返回
Returns an integer less than, equal to, or greater than zero if s1 is found, respectively, to be less than, to match, or be greater than s2.
Support System:
linux liteos freertos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strcspn()

unsigned int osal_strcspn ( const char *  s,
const char *  reject 
)

Get length of a prefix substring.

Description:
This API is used to calculate the length of the initial substring of s which does not contain letters in reject.
参数
s[in] The string to be searched.
reject[in] The string to avoid.
返回
Returns the number of bytes in the initial segment of s which are not in the string reject.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strlen()

unsigned int osal_strlen ( const char *  s)

Calculate the length of a string.

Description:
This API is used to calculate the length of a string.
参数
s[in] the string to be calculated.
返回
Returns the number of characters in the string pointed to by s.
Support System:
linux liteos freertos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strncasecmp()

int osal_strncasecmp ( const char *  s1,
const char *  s2,
unsigned long  size 
)

Compare two strings ignoring case.

Description:
This API is used to compare first size bytes of strings s1 and s2 byte-by-byte, ignoring the case of the characters.
参数
s1[in] the string to be compared.
s2[in] the string to be compared.
size[in] the size of the string.
返回
Returns an integer less than, equal to, or greater than zero if the first size bytes of s1 is found, respectively, to be less than, to match, or be greater than s2.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strnchr()

char * osal_strnchr ( const char *  s,
int  count,
int  c 
)

Find a character in a length limited string.

Description:
This API is used to find a character in a length limited string.
参数
s[in] the string to be searched.
count[in] the number of characters to be searched.
c[in] the character to search for.
返回
Returns a pointer to the first occurrence of the character c in the string s.
Support System:
linux liteos.

◆ osal_strncmp()

int osal_strncmp ( const char *  s1,
const char *  s2,
unsigned long  size 
)

Compare two strings.

Description:
This API is used to compare first size bytes of two strings.
参数
s1[in] the string to be compared.
s2[in] the string to be compared.
size[in] the size of the string.
返回
Returns an integer less than, equal to, or greater than zero if the first size bytes of s1 is found, respectively, to be less than, to match, or be greater than s2.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strnlen()

unsigned int osal_strnlen ( const char *  s,
unsigned int  size 
)

Determine the length of a fixed-size string.

Description:
This API is used to determine the length of a fixed-size string.
参数
s[in] the string to be calculated.
size[in] the length of string.
返回
Returns the number of characters in the string pointed to by s, excluding the terminating null byte ('\0'), but at most size. In doing this, strnlen() looks only at the first size characters in the string pointed to by s and never beyond s+size.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strnstr()

char * osal_strnstr ( const char *  s1,
const char *  s2,
int  n 
)

Locate a substring in a length limited string.

Description:
This API is used to locate a substring in a length limited string.
参数
s1[in] the string to be searched.
s2[in] the substring to search for.
n[in] the length of string.
返回
Returns a pointer to the first occurrence of the substring s2 in the string s1.
Support System:
linux liteos.

◆ osal_strpbrk()

char * osal_strpbrk ( const char *  s1,
const char *  s2 
)

Search a string for any of a set of bytes.

Description:
This API is used to search a string for any of a set of bytes.
参数
s1[in] The string to be searched.
s2[in] The characters to search for.
返回
Returns a pointer to the byte in s1 that matches one of the bytes in s2, or NULL if no such byte is found.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strrchr()

char * osal_strrchr ( const char *  s,
int  c 
)

Find the last occurrence of a character in a string.

Description:
This API is used to find a character in a length limited string.
参数
s[in] the string to be searched.
c[in] the character to search for.
返回
Returns a pointer to the last occurrence of the character c in the string s.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strsep()

char * osal_strsep ( char **  s,
const char *  ct 
)

Extract token from string.

Description:
This API is used to extract token from string.
参数
s[in/out] The string to be searched.
ct[in] The characters to search for.
返回
Returns a pointer to the token, that is, it returns the original value of *s.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strspn()

unsigned int osal_strspn ( const char *  s,
const char *  accept 
)

Get length of a prefix substring.

Description:
This API is used to calculate the length of the initial substring of s which only contain letters in accept.
参数
s[in] The string to be searched.
accept[in] The characters to search for.
返回
Returns the number of bytes in the initial segment of s which consist only of bytes from accept.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strstr()

char * osal_strstr ( const char *  s1,
const char *  s2 
)

Locate a substring.

Description:
This API is used to locate a substring.
参数
s1[in] the string to be searched.
s2[in] the substring to search for.
返回
Returns a pointer to the first occurrence of the substring s2 in the string s1.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strtol()

long osal_strtol ( const char *  cp,
char **  endp,
unsigned int  base 
)

Convert a string to a long integer.

Description:
The strtoll() function converts the initial part of the string in cp to a long int value according to the given base, which must be between 2 and 36 inclusive, or be the special value 0. The string may begin with an arbitrary amount of white space (as determined by isspace(3)) followed by a single optional '+' or '-' sign. If base is zero or 16, the string may then include a "0x" prefix, and the number will be read in base 16; otherwise, a zero base is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to a long int value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.) If endp is not NULL, strtol() stores the address of the first invalid character in *endp. If there were no digits at all, strtol() stores the original value of cp in *endp (and returns 0). In particular, if *cp is not '\0' but **endp is '\0' on return, the entire string is valid.
参数
cp[in] The string to be converted.
endp[in/out] Stores the result.
base[in] The base of conversion.
返回
Returns either the result of the conversion or, if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow; in the latter case, strtol() returns LONG_MAX and sets errno to ERANGE.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strtoll()

long long osal_strtoll ( const char *  cp,
char **  endp,
unsigned int  base 
)

Convert a string to a long long integer.

Description:
The strtoll() function converts the initial part of the string in cp to a long long int value according to the given base, which must be between 2 and 36 inclusive, or be the special value 0. The string may begin with an arbitrary amount of white space (as determined by isspace(3)) followed by a single optional '+' or '-' sign. If base is zero or 16, the string may then include a "0x" prefix, and the number will be read in base 16; otherwise, a zero base is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to a long long int value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.) If endp is not NULL, strtoll() stores the address of the first invalid character in *endp. If there were no digits at all, strtoll() stores the original value of cp in *endp (and returns 0). In particular, if *cp is not '\0' but **endp is '\0' on return, the entire string is valid.
参数
cp[in] The string to be converted.
endp[in/out] Stores the result.
base[in] The base of conversion.
返回
Returns either the result of the conversion or, if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow; in the latter case, strtoll() returns LLONG_MAX and sets errno to ERANGE.
Support System:
linux.

◆ osal_strtoul()

unsigned long osal_strtoul ( const char *  cp,
char **  endp,
unsigned int  base 
)

Convert a string to an unsigned long integer.

Description:
The strtoul() function converts the initial part of the string in cp to an unsigned long int value according to the given base, which must be between 2 and 36 inclusive, or be the special value 0. The string may begin with an arbitrary amount of white space (as determined by isspace(3)) followed by a single optional '+' or '-' sign. If base is zero or 16, the string may then include a "0x" prefix, and the number will be read in base 16; otherwise, a zero base is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to an unsigned long int value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.) If endp is not NULL, osal_strtoul() stores the address of the first invalid character in *endp. If there were no digits at all, osal_strtoul() stores the original value of cp in *endp (and returns 0). In particular, if *cp is not '\0' but **endp is '\0' on return, the entire string is valid.
参数
cp[in] The string to be converted.
endp[in/out] Stores the result.
base[in] The base of conversion.
返回
Returns either the result of the conversion or, if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow; in the latter case, osal_strtoul() returns ULONG_MAX and sets errno to ERANGE.
Support System:
linux liteos.
注意
the implementation is in libc, the parameters should be valid as calling libc interface.

◆ osal_strtoull()

unsigned long long osal_strtoull ( const char *  cp,
char **  endp,
unsigned int  base 
)

Convert a string to an unsigned long long integer.

Description:
The strtoull() function converts the initial part of the string in cp to an unsigned long long int value according to the given base, which must be between 2 and 36 inclusive, or be the special value 0. The string may begin with an arbitrary amount of white space (as determined by isspace(3)) followed by a single optional '+' or '-' sign. If base is zero or 16, the string may then include a "0x" prefix, and the number will be read in base 16; otherwise, a zero base is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal). The remainder of the string is converted to an unsigned long long int value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter 'A' in either uppercase or lowercase represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.) If endp is not NULL, strtoull() stores the address of the first invalid character in *endp. If there were no digits at all, strtoull() stores the original value of cp in *endp (and returns 0). In particular, if *cp is not '\0' but **endp is '\0' on return, the entire string is valid.
参数
cp[in] The string to be converted.
endp[in/out] Stores the result.
base[in] The base of conversion.
返回
Returns either the result of the conversion or, if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow; in the latter case, strtoull() returns ULLONG_MAX and sets errno to ERANGE.
Support System:
linux.