JabberWerxC  2015.1.1
Functions
str.h File Reference

Standard string functions that handle NULL inputs. More...

#include "../basics.h"

Go to the source code of this file.

Functions

JABBERWERX_API int jw_atoi (const char *a, int def)
 
JABBERWERX_API size_t jw_strlen (const char *a)
 
JABBERWERX_API size_t jw_strnlen (const char *a, size_t len)
 
JABBERWERX_API int jw_strcmp (const char *a, const char *b)
 
JABBERWERX_API int jw_strcasecmp (const char *a, const char *b)
 
JABBERWERX_API int jw_strncmp (const char *a, const char *b, size_t n)
 
JABBERWERX_API int jw_strncasecmp (const char *a, const char *b, size_t n)
 

Detailed Description

Standard string functions that handle NULL inputs.

Copyrights

Portions created or assigned to Cisco Systems, Inc. are Copyright (c) 2010-2015 Cisco Systems, Inc. All Rights Reserved. See LICENSE for details.

Function Documentation

JABBERWERX_API int jw_atoi ( const char *  a,
int  def 
)

Converts the given string into an integer. This function behaves as atoi, except that a may be NULL.

Parameters
aThe string to convert to an integer
defThe default value to return
Return values
intThe integer representation of a, or def if NULL
JABBERWERX_API int jw_strcasecmp ( const char *  a,
const char *  b 
)

Compares two NULL-terminated strings (case-insensitive), allowing for either to be NULL. This function behaves as strcasecmp, with the difference that a and/or b may be NULL.

Parameters
aThe first string to compare
bThe second string to compare
Return values
intless than 0 if a is before b; greater than 0 if a is after b; 0 if a and be are equal
JABBERWERX_API int jw_strcmp ( const char *  a,
const char *  b 
)

Compares two NULL-terminated strings (case-sensitive), allowing for either to be NULL. This function behaves as strcmp, with the difference that a and/or b may be NULL.

Parameters
aThe first string to compare
bThe second string to compare
Return values
intless than 0 if a is before b; greater than 0 if a is after b; 0 if a and be are equal
JABBERWERX_API size_t jw_strlen ( const char *  a)

Determines the length of the given string. This function behaves as strlen, except that a may be NULL.

Parameters
aThe string to determine the length of
Return values
size_tThe length of a, or 0 if a is NULL
JABBERWERX_API int jw_strncasecmp ( const char *  a,
const char *  b,
size_t  n 
)

Compares two NULL-terminated strings (case-insensitive), allowing for either to be NULL. This function behaves as strncasecmp, with the difference that a and/or b may be NULL.

Parameters
aThe first string to compare
bThe second string to compare
nThe number of bytes to compare
Return values
intless than 0 if a is before b; greater than 0 if a is after b; 0 if a and be are equal
JABBERWERX_API int jw_strncmp ( const char *  a,
const char *  b,
size_t  n 
)

Compares part of two NULL-terminated strings, allowing for either to be NULL. This function behaves as strncmp, with the difference that a and/or b may be NULL.

Parameters
aThe first string to compare
bThe second string to compare
nThe number of bytes to compare
Return values
intless than 0 if a is before b; greater than 0 if a is after b; 0 if a and be are equal
JABBERWERX_API size_t jw_strnlen ( const char *  a,
size_t  len 
)

Determines the length of the given string. This function behaves as strnlen, except that a may be NULL.

Parameters
aThe string to determine the length of
lenThe maximum length to consider
Return values
size_tThe length of a, or 0 if a is NULL